summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-05-30 23:27:38 +0000
committerChris Lattner <sabre@nondot.org>2010-05-30 23:27:38 +0000
commit52d96ac930477e0392a19b66ce645c7d809857ea (patch)
tree1c500bf2b476347adb6da437577d177733bc64f9 /clang/lib/Lex
parentfe4a4107d80dfc0f42eddce4e62cdd888ccba5cb (diff)
downloadbcm5719-llvm-52d96ac930477e0392a19b66ce645c7d809857ea.tar.gz
bcm5719-llvm-52d96ac930477e0392a19b66ce645c7d809857ea.zip
simpler fix for rdar://8044135 - escaped newlines have already
been processed, so they don't have to be tip-toed around. llvm-svn: 105182
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/Lexer.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 4f2e29e80d4..84457fa2c83 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud