[cfe-commits] r148704 - in /cfe/trunk: lib/Frontend/DiagnosticRenderer.cpp lib/Lex/Lexer.cpp unittests/Lex/LexerTest.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Jan 23 10:30:23 PST 2012


On Jan 23, 2012, at 9:27 AM, Chandler Carruth wrote:

> On Mon, Jan 23, 2012 at 8:58 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Improve Lexer::getImmediateMacroName to take into account inner macros
> of macro arguments.
> 
> For "MAC1( MAC2(foo) )" and location of 'foo' token it would return
> "MAC1" instead of "MAC2".
> 
> This comment, and the comment on the static helper in the DiagnosticRenderer are at odds... which one is it that returns MAC2 and which one MAC1?

On the above message, I say what Lexer::getImmediateMacroName did *before* the commit. On code comments I say what it does now.
Lexer::getImmediateMacroName will return "MAC2"
the static helper in DiagnosticRenderer will return "MAC1"

> 
> It would be good (i think) to call only one of them "immediate", the one returning MAC2.

This or see if DiagnosticRenderer can use the Lexer one.

> 
> Does this impact diagnostic output in any way? If so could you include a testcase that demonstrates that impact?

DiagnosticRenderer was dependent on the previous behavior, test/Misc/caret-diags-macros.c would fail; just change the DiagnosticRenderer to use the Lexer one and you'll see.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120123/15db093b/attachment.html>


More information about the cfe-commits mailing list