[cfe-dev] A suggestion and questions about ASTMatchers

Christian Schafmeister chris.schaf at verizon.net
Fri Jan 17 12:50:34 PST 2014

Question 1:

Would it be possible to have hasParameter(unsigned N,…), hasArgument(unsigned N,…), hasTemplateArgument(unsigned N,…) etc
to take signed integer N as an argument and use negative values to address the parameters, arguments etc from the right hand side of the list?

Or is there another way to explicitly match on the last or second last parameter, argument etc if I don’t know how many entries are available for a particular node?

Question 2: 
When reading the documentation at http://clang.llvm.org/docs/LibASTMatchersReference.html

What does it mean in the AST Traversal Matchers when the Parameters are "Matcher<Type>"   vs "Matcher<Expr> InnerMatcher”?
What does the “InnerMatcher” part refer to - if this is anything other than the matcher argument that you put inside the parentheses as an argument.   If all it means is the argument then why does “hasElementType” have the parameter “Matcher<Type>”?

Sorry if question 2 is not very clear, perhaps I’m reading too much into what is written in the parameter column of each matcher.



Christian Schafmeister
chris.schaf at verizon.net

More information about the cfe-dev mailing list