[cfe-dev] ASTMatcher for assert()

Manuel Klimek klimek at google.com
Wed Jun 11 00:30:32 PDT 2014


On Tue, Jun 10, 2014 at 7:26 PM, Richard <legalize at xmission.com> wrote:

>
> In article <CAOsfVv=
> aBdSiMydayJkqiUEuRDzsZXUG0ArWyNHPHoDraUdZaA at mail.gmail.com>,
>     Manuel Klimek <klimek at google.com> writes:
>
> > On Fri, Jun 6, 2014 at 9:04 PM, Richard <legalize at xmission.com> wrote:
> >
> > > I'm thinking of contributing a matcher that allows you to match nodes
> > > based on the associated source file so that you can easily discard
> > > matches outside the directory hierarchy(ies) of interest. [...]
> >
> > I think it's a good idea, but will not solve the general problem of
> > surprise when encountering source locations.
>
> I take it you are referring to the discussion on this thread of:
>
> - do I refactor the location where a macro is invoked?
> - do I refactor the location where a macro is defined?
>
> Are there any other surprises relating to source location other than
> those relating to the site of a macro invocation vs. the site of a
> macro definition?
>

Well, the problem that there are not only two locations to think about -
macro expansion can have arbitrarily many steps, and which level of
expansion is needed usually depends on what part of the AST one is looking
at

a.h:
#define A(x) a(x)
b.h:
#define B(x) b(x)
c.cc:
B(c());

Now depending which part of a(b(c())) you want to look at, you'll get a
different file.




> --
> "The Direct3D Graphics Pipeline" free book <
> http://tinyurl.com/d3d-pipeline>
>      The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
>          The Terminals Wiki <http://terminals.classiccmp.org>
>   Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140611/05a268b1/attachment.html>


More information about the cfe-dev mailing list