[cfe-dev] Lexical scope for macro expansion

Chris Lattner clattner at apple.com
Thu Dec 10 09:37:51 PST 2009


On Dec 10, 2009, at 8:56 AM, Abramo Bagnara wrote:

> 
> Is there any way from MacroExpands callback to reach current lexical scope?
> 
> What I'm trying to do is to detect if some identifiers in the macro body
> is a known typedef id.

Nope, there is no way to do this, because the lexer/preprocessor lives at a lower level (and macros can be used and defined in multiple contexts, and don't follow the grammar of the language).  However, given a typedef, you can tell if it came from a macro.

-Chris



More information about the cfe-dev mailing list