[cfe-dev] Running AST matchers on part of the AST

Aleksei Sidorin via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 29 08:20:29 PDT 2016


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);
}

>
> Hi,
>
> I would like to run some dynamic matchers on a single function body or I
> can either run it the full AST (MatchFinder::matchAST) or on a single
> node (MatchFinder::match).
>
>
> What is the best way to achieve what I want ? Do you think it is worth I
> change clang's code and submit a patch ?
>
>
> Thanks,
>
> David.
>
>


-- 
Best regards,
Aleksei Sidorin
Software Engineer,
IMSWL-IMCG, SRR, Samsung Electronics




More information about the cfe-dev mailing list