Semi dynamic building AST Matcher


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

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.