<div class="gmail_quote">On Sat, Feb 25, 2012 at 3:18 AM, Abramo Bagnara <span dir="ltr"><<a href="mailto:abramo.bagnara@gmail.com">abramo.bagnara@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the source below I need to be able to detect that the token 4 has<br>
been expanded by body of macro z, but I'm unable to do that.<br>
<br>
Asking for immediate expansion range of expanded location I get a<br>
MacroArgExpansion loc for argument x whose immediate expansion range is<br>
macro p.<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>The code that does this in diagnostics is DiagnosticRenderer::emitMacroExpansionsAndCarets (and its associated helper routines).</div></div>