The best way to handle this is to use AST algorithms. you can basically search for all callExpr nodes in the AST method and bind them and at the same time bind the corresponding caller nodes (CXXRecordDecl) with another string as well.
Example:
CallBackFunc callBackFunc; Matchers.addMatcher(callExpr(isExpansionInMainFile(), callee(), hasAncestor(recordDecl().bind("caller"))).bind("callee"), &callBackFunc);
Then in the callBack function you can get theses of the called and calling functions, like this:
class CallBackFunc : public MatchFinder::MatchCallBack { public: virtual void run(const MatcherFinder::MatchResult &Results) { auto callee = Results.Nodes.getNodeAs<clang::CallExpr>("callee"); auto caller = Results.Nodes.getNodeAs<clang::CXXRecordDecl>("caller");
(if necessary, I can provide additional information)
Gill
source share