<div dir="ltr">On Fri, Apr 26, 2013 at 3:02 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"><br><div class="gmail_quote"><div class="im">On Fri, Apr 26, 2013 at 12:45 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"><div>Note that the AST dump does not contain all the information there is (or it would be completely unreadable).</div>

<div><br></div></blockquote></div><div>Is there any way to do a very verbose dump rooted at a specific expression?</div></div></div></div></blockquote><div><br></div><div style>Nope. Patches welcome, I guess :)</div><div style>
 <br></div><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="gmail_quote"><div class="im"><div> </div><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">

<div></div><div>With AST matchers, you can currently only match the "C++" names of things. After matching the call, you can look at the expansion location of the identifier that references the function (get it via the SourceManager) or try to directly use the Lexer's makeFileCharRange.</div>

</blockquote></div></div><br>To simplify the problem, I'll hack the code in this case to use a fake prototype, one that looks like the macro interface.  Then the problem becomes manipulating the parameters.</div><div class="gmail_extra">

<br></div><div class="gmail_extra">I see in the match test code stuff like:<br><br><div class="gmail_extra">  const char Program[] =</div><div class="gmail_extra">      "struct T { };"</div><div class="gmail_extra">

      "int f(int, T*, int, int);"</div><div class="gmail_extra">      "void g(int x) { T t; f(x, &t, 3, 4); }";</div><div class="gmail_extra"> ...</div><div class="gmail_extra">  EXPECT_TRUE(matches(Program,</div>

<div class="gmail_extra">      callExpr(allOf(callee(functionDecl(hasName("f"))),</div><div class="gmail_extra">                     hasArgument(0, declRefExpr(to(varDecl()))),</div><div class="gmail_extra">                     hasArgument(1, hasType(pointsTo(</div>

<div class="gmail_extra">                                        recordDecl(hasName("T"))))),</div><div class="gmail_extra">                     hasArgument(2, integerLiteral(equals(3))),</div><div class="gmail_extra">

                     hasArgument(3, integerLiteral(equals(4)))))));</div><div><br></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">How would I bind the matcher to one of these parameters?</div></div>
</blockquote><div><br></div><div><br></div><div style>integerLiteral(equals(3)).bind("x"); same for declRefExpr. The only thing you cannot bind here is "hasType", but I'm surprised this compiles at all... stmt(hasType(pointsTo(...))).bind("x") should work...</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div></div></div></div>