diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-30 23:27:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-30 23:27:38 +0000 |
commit | 571339c215dc3fa44acccb89c7c6b1d5b962b7f2 (patch) | |
tree | 6f14d719cb6fb9f9b27c2882c1bee351e3c2ef14 /lib/Lex/Lexer.cpp | |
parent | 33611e0d5ab1372608a7649b1877cd4300621c71 (diff) |
simpler fix for rdar://8044135 - escaped newlines have already
been processed, so they don't have to be tip-toed around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 4f2e29e80d..84457fa2c8 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -752,24 +752,21 @@ void Lexer::LexStringLiteral(Token &Result, const char *CurPtr, bool Wide) { 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); } |