fix rdar://8823139, a crash on a comment in a preprocessed .s file

that contains the ## operator.

llvm-svn: 122946
This commit is contained in:
Chris Lattner 2011-01-06 05:01:51 +00:00
parent 9ec19ea06a
commit 56f64c14b7
2 changed files with 11 additions and 0 deletions

View 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.

View File

@ -72,3 +72,8 @@
11: T11(b)
// CHECK-Identifiers-True: 11: #0
// This should not crash
// rdar://8823139
# ##
// CHECK-Identifiers-False: # ##