[cfe-dev] issues about AST Matcher Reference

Manuel Klimek klimek at google.com
Wed Sep 11 05:10:00 PDT 2013


To the original question:
I assume you have been using a 'using' declaration to get equalsBoundNode
from the right namespace?


On Tue, Sep 10, 2013 at 3:50 PM, John Criswell <criswell at illinois.edu>wrote:

>  Dear Shu,
>
> Please send questions like this to the cfe-dev mailing list.  The owners
> of the mailing list should only be contacted for administrative questions
> (e.g., when you need help subscribing or unsubscribing to/from the list).
>
> Regards,
>
> John Criswell
>
>
> On 9/10/13 7:47 AM, Shu,Kaikai wrote:
>
>  *AST Matcher Reference*
>
> http://clang.llvm.org/docs/LibASTMatchersReference.html**
>
> ** **
>
> in this page, the example fellows not work and when compile, error message
> is : error: 'equalsBoundNode' was not declared in this scope****
>
> I can’t get a way to solve this, can someone give me some help? please****
>
> ** **
>
> ** **
>
> ** **
>
> Matcher<Decl <http://clang.llvm.org/doxygen/classclang_1_1Decl.html>>****
>
> equalsBoundNode****
>
> std::string ID****
>
> ** **
>
> Matches if a node equals a previously bound node.****
>
> ** **
>
> Matches a node if it equals the node previously bound to ID.****
>
> ** **
>
> Given****
>
>   class X { int a; int b; };****
>
> recordDecl(****
>
>     has(fieldDecl(hasName("a"), hasType(type().bind("t")))),****
>
>     has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))****
>
>   matches the class X, as a and b have the same type.****
>
> ** **
>
> Note that when multiple matches are involved via forEach* matchers,****
>
> equalsBoundNodes acts as a filter.****
>
> For example:****
>
> compoundStmt(****
>
>     forEachDescendant(varDecl().bind("d")),****
>
>     forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))****
>
> will trigger a match for each combination of variable declaration****
>
> and reference to that variable declaration within a compound statement.***
> *
>
> ** **
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130911/55f82a35/attachment.html>


More information about the cfe-dev mailing list