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

Method findAssignOperator

tests/TestASTUtils.cpp:77–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 const Expr *findAssignOperator(ASTUnit &Unit, std::string CallerName) const {
78 const std::string Tag = "Tag";
79 std::vector<const Expr *> Exprs;
80 auto &Ctx = Unit.getASTContext();
81 auto Matcher =
82 binaryOperator(hasAncestor(functionDecl(hasName(CallerName))),
83 isAssignmentOperator())
84 .bind(Tag);
85 for (auto &Node : match(Matcher, Ctx)) {
86 const auto *Record = Node.getNodeAs<Expr>(Tag);
87 if (!Record)
88 continue;
89 Exprs.push_back(Record);
90 }
91 if (Exprs.size() != 1)
92 return nullptr;
93 return Exprs[0];
94 }
95
96 bool load(std::string SrcDir, std::string CodePath) {
97 return load(SrcDir, std::vector<std::string>({CodePath}));

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected