[cfe-dev] diff: builtin macros

Vladimir Kirillov proger at uaoug.org.ua
Thu Sep 2 13:31:20 PDT 2010


> I'm more concerned with keeping the preprocessor as simple as
> possible and consistent.
> "builtin" macros aren't actually macros:
> they're magic things that get expanded by the preprocessor like
> __FILE__ __COUNTER__ etc.  If you'd like to tell whether a macro
> is "part of the implicit gunk that clang sets up" then I think you
> can just check to see if the SourceLocation is part of the predefines
> buffer.

> 
> It looks like PrintPreprocessedOutput.cpp does this by doing this:
> 
> if (Loc.isFileID() &&
>          !strcmp(SourceMgr.getPresumedLoc(Loc).getFilename(),
>                  "<built-in>"))
>   // it is in the predefines buffer.
> 

Great! I'll stick to it.
This really avoids having all the weird parser keywords and such.

Thank you!



More information about the cfe-dev mailing list