I try to match all expressions that call to std::sort, so I wrote code like this
Finder->addMatcher(
callExpr(
callee(functionDecl(hasName(“sort”),
hasDeclContext(namespaceDecl(hasName(“std”))))))
.bind(“stdSortCall”),
this);
Unfortunately, the check function of this class is not called.
I also tried AddMatcher code like this:
Finder->addMatcher( callExpr(callee(functionDecl(matchesName("::std::sort")))).bind("stdSortCall"), this);
but it still didn’t take effect
I tried to search the official documentation, but I can’t seem to find the reason for the failure.
I hope to match all std::sort call statements.