[cfe-dev] Missing info in macro expansion chain
chandlerc at google.com
Sat Feb 25 03:38:50 PST 2012
On Sat, Feb 25, 2012 at 3:18 AM, Abramo Bagnara <abramo.bagnara at gmail.com>wrote:
> In the source below I need to be able to detect that the token 4 has
> been expanded by body of macro z, but I'm unable to do that.
> Asking for immediate expansion range of expanded location I get a
> MacroArgExpansion loc for argument x whose immediate expansion range is
> macro p.
Can you clarify exactly what it is you're doing? This information is there
to be dug out. You can see that it is preserved and that we use it in the
caret diagnostics, check out the very first test in
test/Misc/caret-diags-macro.c which should be exactly the same as your case.
You'll likely need to combine getting the immediate expansion w/ getting
the immediate spelling location and then getting its expansion in order to
alternate between tracing the argument down and the text the user wrote.
The code that does this in diagnostics is
DiagnosticRenderer::emitMacroExpansionsAndCarets (and its associated helper
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev