fix rdar://6757323, where an escaped newline in a // comment

was causing the char after the newline to get eaten.

llvm-svn: 68430
This commit is contained in:
Chris Lattner 2009-04-05 00:26:41 +00:00
parent fff33a3cdf
commit ecdaf40c9e
2 changed files with 14 additions and 0 deletions

View File

@ -849,6 +849,14 @@ bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) {
C = getAndAdvanceChar(CurPtr, Result);
LexingRawMode = OldRawMode;
// If the char that we finally got was a \n, then we must have had something
// like \<newline><newline>. We don't want to have consumed the second
// newline, we want CurPtr, to end up pointing to it down below.
if (C == '\n' || C == '\r') {
--CurPtr;
C = 'x'; // doesn't matter what this is.
}
// If we read multiple characters, and one of those characters was a \r or
// \n, then we had an escaped newline within the comment. Emit diagnostic
// unless the next line is also a // comment.

View File

@ -0,0 +1,6 @@
// RUN: clang -fsyntax-only %s
// rdar://6757323
// foo \
#define blork 32