[cfe-commits] r67539 - in /cfe/trunk: lib/Lex/TokenLexer.cpp test/Preprocessor/assembler-with-cpp.c

Chris Lattner sabre at nondot.org
Mon Mar 23 10:32:45 PDT 2009


Author: lattner
Date: Mon Mar 23 12:32:45 2009
New Revision: 67539

URL: http://llvm.org/viewvc/llvm-project?rev=67539&view=rev
Log:
The individual pieces of an invalid paste as still candidates for expansion.
This matters in assembler mode, where this is silently allowed.
This fixes rdar://6709206.

Modified:
    cfe/trunk/lib/Lex/TokenLexer.cpp
    cfe/trunk/test/Preprocessor/assembler-with-cpp.c

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

==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Mon Mar 23 12:32:45 2009
@@ -448,7 +448,9 @@
         if (!PP.getLangOptions().AsmPreprocessor)
           PP.Diag(PasteOpLoc, diag::err_pp_bad_paste)
             << std::string(Buffer.begin(), Buffer.end()-1);
-        return false;
+        
+        // Do not consume the RHS.
+        --CurToken;
       }
     
       // Turn ## into 'unknown' to avoid # ## # from looking like a paste

Modified: cfe/trunk/test/Preprocessor/assembler-with-cpp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/assembler-with-cpp.c?rev=67539&r1=67538&r2=67539&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/assembler-with-cpp.c (original)
+++ cfe/trunk/test/Preprocessor/assembler-with-cpp.c Mon Mar 23 12:32:45 2009
@@ -33,4 +33,15 @@
 // RUN: grep "4: ''" %t &&
 4: ''
 
+
+// Portions of invalid pasting should still expand as macros.
+// rdar://6709206
+// RUN: grep "5: expanded (" %t &&
+#define M4 expanded
+#define	M5() M4 ## (
+
+5: M5()
+
+
+
 // RUN: true





More information about the cfe-commits mailing list