[cfe-commits] r105182 - /cfe/trunk/lib/Lex/Lexer.cpp
Chris Lattner
sabre at nondot.org
Sun May 30 16:27:38 PDT 2010
Author: lattner
Date: Sun May 30 18:27:38 2010
New Revision: 105182
URL: http://llvm.org/viewvc/llvm-project?rev=105182&view=rev
Log:
simpler fix for rdar://8044135 - escaped newlines have already
been processed, so they don't have to be tip-toed around.
Modified:
cfe/trunk/lib/Lex/Lexer.cpp
Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=105182&r1=105181&r2=105182&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Sun May 30 18:27:38 2010
@@ -752,24 +752,21 @@
char C = getAndAdvanceChar(CurPtr, Result);
while (C != '"') {
- // Skip escaped characters.
- bool Escaped = false;
- if (C == '\\') {
- // Skip the escaped character.
+ // Skip escaped characters. Escaped newlines will already be processed by
+ // getAndAdvanceChar.
+ if (C == '\\')
C = getAndAdvanceChar(CurPtr, Result);
- Escaped = true;
- }
- if ((!Escaped && (C == '\n' || C == '\r')) || // Newline.
+ if (C == '\n' || C == '\r' || // Newline.
(C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
if (!isLexingRawMode() && !Features.AsmPreprocessor)
Diag(BufferPtr, diag::err_unterminated_string);
FormTokenWithChars(Result, CurPtr-1, tok::unknown);
return;
- } else if (C == 0) {
- NulCharacter = CurPtr-1;
}
-
+
+ if (C == 0)
+ NulCharacter = CurPtr-1;
C = getAndAdvanceChar(CurPtr, Result);
}
More information about the cfe-commits
mailing list