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

Peeter Joot peeter.joot at gmail.com
Fri Apr 26 06:02:09 PDT 2013

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

> Note that the AST dump does not contain all the information there is (or
> it would be completely unreadable).
> Is there any way to do a very verbose dump rooted at a specific expression?

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

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.

I see in the match test code stuff like:

  const char Program[] =
      "struct T { };"
      "int f(int, T*, int, int);"
      "void g(int x) { T t; f(x, &t, 3, 4); }";
                     hasArgument(0, declRefExpr(to(varDecl()))),
                     hasArgument(1, hasType(pointsTo(
                     hasArgument(2, integerLiteral(equals(3))),
                     hasArgument(3, integerLiteral(equals(4)))))));

How would I bind the matcher to one of these parameters?

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

More information about the cfe-dev mailing list