MCPcopy Create free account
hub / github.com/Samsung/UTopia / findCallExpr

Method findCallExpr

tests/TestASTUtils.cpp:45–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 }
44
45 const Expr *findCallExpr(ASTUnit &Unit, std::string CallerName,
46 std::string CalleeName) const {
47 const std::string Tag = "Tag";
48 std::vector<const Expr *> Exprs;
49 auto &Ctx = Unit.getASTContext();
50 auto Matcher =
51 expr(
52 anyOf(callExpr(hasAncestor(functionDecl(hasName(CallerName))),
53 callee(functionDecl(hasName(CalleeName)))),
54 cxxConstructExpr(
55 hasAncestor(functionDecl(hasName(CallerName))),
56 hasDeclaration(cxxConstructorDecl(hasName(CalleeName)))),
57 cxxDeleteExpr(hasAncestor(functionDecl(hasName(CallerName)))),
58 cxxMemberCallExpr(
59 hasAncestor(functionDecl(hasName(CallerName))),
60 callee(functionDecl(hasName(CalleeName)))),
61 cxxNewExpr(hasAncestor(functionDecl(hasName(CallerName)))),
62 cxxOperatorCallExpr(
63 hasAncestor(functionDecl(hasName(CallerName))),
64 callee(functionDecl(hasName(CalleeName))))))
65 .bind(Tag);
66 for (auto &Node : match(Matcher, Ctx)) {
67 const auto *Record = Node.getNodeAs<Expr>(Tag);
68 if (!Record)
69 continue;
70 Exprs.push_back(Record);
71 }
72 if (Exprs.size() != 1)
73 return nullptr;
74 return Exprs[0];
75 }
76
77 const Expr *findAssignOperator(ASTUnit &Unit, std::string CallerName) const {
78 const std::string Tag = "Tag";

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected