diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-05 00:26:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-05 00:26:41 +0000 |
commit | ead616c5d8681a41b11273327813e61bda01907a (patch) | |
tree | a4d62856fe639a6f2068dc3d3497ba7eb9c8d939 /lib/Lex/Lexer.cpp | |
parent | 2b77ba8bc7a842829ad9193816dc1d7d5e9c5be6 (diff) |
fix rdar://6757323, where an escaped newline in a // comment
was causing the char after the newline to get eaten.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 3a3e86a3cf..059afe2182 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -848,6 +848,14 @@ bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) { LexingRawMode = true; 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 |