]> granicus.if.org Git - clang/commitdiff
The individual pieces of an invalid paste as still candidates for expansion.
authorChris Lattner <sabre@nondot.org>
Mon, 23 Mar 2009 17:32:45 +0000 (17:32 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 23 Mar 2009 17:32:45 +0000 (17:32 +0000)
This matters in assembler mode, where this is silently allowed.
This fixes rdar://6709206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67539 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/TokenLexer.cpp
test/Preprocessor/assembler-with-cpp.c

index 1935914e0e1dcbd1129d007be50234aeef275ae5..ec48690b35b4ac31fcfe9acdbd53c179c70e4434 100644 (file)
@@ -448,7 +448,9 @@ bool TokenLexer::PasteTokens(Token &Tok) {
         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
index 2f520ecf07e160e102b06b1cea5ae87c9d85f94c..ecb77e5f964a21e5733c955a2965c7ed0c71ab9f 100644 (file)
 // 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