[cfe-dev] issues about AST Matcher Reference

John Criswell criswell at illinois.edu
Tue Sep 10 06:50:38 PDT 2013


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.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130910/02558f63/attachment.html>


More information about the cfe-dev mailing list