]> granicus.if.org Git - clang/commitdiff
fix rdar://8823139, a crash on a comment in a preprocessed .s file
authorChris Lattner <sabre@nondot.org>
Thu, 6 Jan 2011 05:01:51 +0000 (05:01 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 6 Jan 2011 05:01:51 +0000 (05:01 +0000)
that contains the ## operator.

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

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

index 5f4c321715d5ccbf2ffce01917af0d3b046c53cb..f422d254f0f20f0641a9466915f851a55b3d9f27 100644 (file)
@@ -654,6 +654,12 @@ TryAgain:
     // Return the # and the token after it.
     Toks[0] = SavedHash;
     Toks[1] = Result;
+    
+    // If the second token is a hashhash token, then we need to translate it to
+    // unknown so the token lexer doesn't try to perform token pasting.
+    if (Result.is(tok::hashhash))
+      Toks[1].setKind(tok::unknown);
+    
     // Enter this token stream so that we re-lex the tokens.  Make sure to
     // enable macro expansion, in case the token after the # is an identifier
     // that is expanded.
index 0543077c01c7e9d48772058cffe7020639ad2667..a9c42940a310c8b2e16433379fdd3ad068c4aff7 100644 (file)
@@ -72,3 +72,8 @@
 11: T11(b)
 // CHECK-Identifiers-True: 11: #0
 
+
+// This should not crash
+// rdar://8823139
+# ##
+// CHECK-Identifiers-False: # ##