[cfe-dev] Semi dynamic building AST Matcher

David Come via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 22 08:39:47 PDT 2016


Hi,

I seen 2 ways to build AST matchers : static and dynamic (my wording may 
be wrong).

- The  static one  :auto matcher = recordDecl(hasName("Foo"), 
isDerivedFrom("Bar")) directly written in a C++ file

- The dynamic one with  Parser::parseMatcherExpression

And i was wandering if there was /semi dynamic/ way to build AST matchers ?

Something like
auto matcher = recordDecl();
matcher.add(hasName("Foo"));

The main idea beyond it is to be able to build matcher matching a 
specific AST by visiting the AST
and building the matcher instead of building a string and then 
re-parsing it.

Thanks,
David.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160322/719cc053/attachment.html>


More information about the cfe-dev mailing list