[cfe-dev] SourceLocation -> MacroDefinition(Record?)

Kim Gräsman kim.grasman at gmail.com
Mon May 11 12:15:07 PDT 2015

Hi all,

For IWYU, we can usually make better suggestions if we know whether a
use happens inside a macro or not.

I should be able to use SourceLocation::isMacroID to ask whether I'm
in *a* macro, but is there a way to go from there to *which* macro?
I'm guessing that's represented by the new MacroDefinition class.

I've toyed with the idea of recording all macro definitions in a
PPCallbacks implementation and building a reverse lookup table from
location to macro definition, but I figured Clang might already have
that. Does it?

- Kim

More information about the cfe-dev mailing list