[cfe-dev] ASTMatcher for assert()

Richard legalize at xmission.com
Wed Jun 11 09:44:20 PDT 2014


In article <CAOsfVvm9hiRBifj1VbotCHMUdck_vg_2wSy6bgPAxxE7UHnwOg at mail.gmail.com>,
    Manuel Klimek <klimek at google.com> writes:

> On Tue, Jun 10, 2014 at 7:26 PM, Richard <legalize at xmission.com> wrote:
> > 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.

Ah, yes, very good point.  (I tend to think of macros mentally in a
single-level of expansion, but obviously it's more involved than that.)

So... maybe we need some mechanism that let you drill down through macro
expansion one expansion at a time?

I want to play more with refactoring applied to macros, so I should do
some spike coding and see what's involved and what would be useful
beyond my own experiment.
-- 
"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>



More information about the cfe-dev mailing list