[cfe-dev] A suggestion and questions about ASTMatchers
Manuel Klimek
klimek at google.com
Thu Jan 23 05:30:45 PST 2014
On Fri, Jan 17, 2014 at 9:50 PM, Christian Schafmeister <
chris.schaf at verizon.net> wrote:
> 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?
>
It most certainly would...
> 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?
>
Nope. You can of course always match "any" (and bind it) and then use the
callback to figure out which one it was.
> 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>”?
>
Yes, I think it's pretty much what you're saying :)
>
> 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.
>
> Best,
>
> .Chris.
>
>
>
>
> Christian Schafmeister
> chris.schaf at verizon.net
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140123/e3d422fa/attachment.html>
More information about the cfe-dev
mailing list