[cfe-commits] r70793 - in /cfe/trunk: lib/Lex/TokenLexer.cpp test/Preprocessor/macro_paste_spacing2.c

Eli Friedman eli.friedman at gmail.com
Sun May 3 12:16:01 PDT 2009


Author: efriedma
Date: Sun May  3 14:16:00 2009
New Revision: 70793

URL: http://llvm.org/viewvc/llvm-project?rev=70793&view=rev
Log:
Fix for PR4132: make sure to insert whitespace consistently before a 
pasted token.


Added:
    cfe/trunk/test/Preprocessor/macro_paste_spacing2.c
Modified:
    cfe/trunk/lib/Lex/TokenLexer.cpp

Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=70793&r1=70792&r2=70793&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Sun May  3 14:16:00 2009
@@ -222,7 +222,7 @@
       
       // If the next token was supposed to get leading whitespace, ensure it has
       // it now.
-      if (NextTokGetsSpace) {
+      if (CurTok.hasLeadingSpace() || NextTokGetsSpace) {
         ResultToks[ResultToks.size()-NumToks].setFlag(Token::LeadingSpace);
         NextTokGetsSpace = false;
       }

Added: cfe/trunk/test/Preprocessor/macro_paste_spacing2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_paste_spacing2.c?rev=70793&view=auto

==============================================================================
--- cfe/trunk/test/Preprocessor/macro_paste_spacing2.c (added)
+++ cfe/trunk/test/Preprocessor/macro_paste_spacing2.c Sun May  3 14:16:00 2009
@@ -0,0 +1,5 @@
+// RUN: clang-cc %s -E | grep "movl %eax"
+
+#define R1E %eax
+#define epilogue(r1) movl r1;
+epilogue(R1E)





More information about the cfe-commits mailing list