MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / get_apps_of

Method get_apps_of

smt/expr.cpp:2408–2430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2406}
2407
2408set<expr> expr::get_apps_of(const char *fn_name, const char *prefix) const {
2409 C();
2410 vector<expr> worklist = { *this };
2411 unordered_set<Z3_ast> seen;
2412 set<expr> ret;
2413 do {
2414 auto val = std::move(worklist.back());
2415 worklist.pop_back();
2416
2417 for (unsigned i = 0, e = val.getFnNumArgs(); i < e; ++i) {
2418 expr arg = val.getFnArg(i);
2419 if (arg.isApp() && seen.emplace(arg()).second)
2420 worklist.emplace_back(std::move(arg));
2421 }
2422
2423 auto str = val.fn_name();
2424 if (str == fn_name || str.starts_with(prefix)) {
2425 ret.emplace(std::move(val));
2426 }
2427 } while (!worklist.empty());
2428
2429 return ret;
2430}
2431
2432void expr::printUnsigned(ostream &os) const {
2433 os << numeral_string();

Callers

nothing calls this directly

Calls 5

getFnNumArgsMethod · 0.80
getFnArgMethod · 0.80
isAppMethod · 0.80
fn_nameMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected