[cfe-dev] ast_matchers::MatchFinder to CallExpr that's a macro call

Peeter Joot peeter.joot at gmail.com
Fri Apr 26 09:08:25 PDT 2013

On Fri, Apr 26, 2013 at 11:07 AM, Manuel Klimek <klimek at google.com> wrote:

> Sorry, of course expr(hasType(...)).bind(...) :)

Okay thanks, that compiles now.  However, it appears that my attempt to
match to the void ** itself is not working.  Even if I take out the attempt
to bind to the parameter and just bind to the whole call statement, it
doesn't trigger.  Example:

        callExpr( callee(functionDecl(hasName("myfunc"))) ).bind("x"),

triggers the callback:

match callback
<s>myfunc( &r )</s>
match callback
<s>myfunc( (void **)&r )</s>

where the source was:

int myfunc( void ** ppBlkPtr ) ;

void blah(void)
   //int * r ;
   void * r ;

   myfunc( &r ) ;
   myfunc( (void **)&r ) ;

But this matcher doesn't trigger:

        callExpr( allOf(
//                 expr(
                       pointsTo( recordDecl(hasName("void")) )
//                       ).bind("x")

Maybe my best bet is not to try to use this matcher infrastructure for
anything bug the call itself, and then manipulate or navigate that portion
of the AST directly in the callback.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130426/06f3b9d4/attachment.html>

More information about the cfe-dev mailing list