Running AST matchers on part of the AST

Hello David,

You can use MatchFinder::match<...>() method.
Example:

void matchStmt(const Stmt *S, ASTContext &Ctx) {
   MatchFinder Finder;
   Finder.addMatcher(someMatcher, &Callback);
   Finder.match<Stmt>(*S, Ctx);
}

That's what I tried but it didn't work. If S is function's body, it will not run the matcher on child nodes.

I assumed it would run the matcher on the node only and doesn't do the traversal to match S'child nodes.

Use hasDescendant. Also, just use the free standing match function.