<div dir="ltr">On Fri, Apr 26, 2013 at 6:08 PM, Peeter Joot <span dir="ltr"><<a href="mailto:peeter.joot@gmail.com" target="_blank">peeter.joot@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="im"><br><div class="gmail_quote">On Fri, Apr 26, 2013 at 11:07 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Sorry, of course expr(hasType(...)).bind(...) :)</blockquote>
</div><br></div>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:<br>
<br><div class="gmail_extra"> Finder.addMatcher(</div><div class="gmail_extra"> callExpr( callee(functionDecl(hasName("myfunc"))) ).bind("x"),</div><div class="gmail_extra"> &gmblkCallBack);</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">triggers the callback:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">match callback</div><div class="gmail_extra">
<s>myfunc( &r )</s></div><div class="gmail_extra">match callback</div><div class="gmail_extra"><s>myfunc( (void **)&r )</s></div><div><br></div><div>where the source was:</div><div>
<br></div><div><div class="im"><div>int myfunc( void ** ppBlkPtr ) ;</div><div><br></div><div>void blah(void)</div><div>{</div></div><div> //int * r ;</div><div> void * r ;</div><div><br></div><div> myfunc( &r ) ;</div>
<div> myfunc( (void **)&r ) ;</div>
<div>}</div><div><br></div></div><div>But this matcher doesn't trigger:</div></div><div class="im"><div class="gmail_extra"><br></div><div class="gmail_extra"> Finder.addMatcher(</div><div class="gmail_extra"> callExpr( allOf(</div>
<div class="gmail_extra"> callee(functionDecl(hasName("myfunc"))),</div></div><div class="gmail_extra"> hasArgument(0,</div><div class="gmail_extra">// expr(</div><div class="im">
<div class="gmail_extra">
hasType(</div><div class="gmail_extra"> pointsTo(</div><div class="gmail_extra"> pointsTo( recordDecl(hasName("void")) )</div><div class="gmail_extra">
)</div><div class="gmail_extra"> )</div></div><div class="gmail_extra">// ).bind("x")</div><div class="im"><div class="gmail_extra"> )</div>
<div class="gmail_extra">
))</div><div class="gmail_extra"> .bind("x")</div></div><div class="gmail_extra"> ,</div><div class="gmail_extra"> &gmblkCallBack);</div><div><br></div></div><div class="gmail_extra">
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.</div></div></blockquote><div><br></div>
<div style>void cannot be matched with recordDecl - that's where your match fails. I haven't played around with void pointers yet, but I'd assume you'll want something with builtinType(asString("void")) or something similar...</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div></div></div></div>