[llvm-branch-commits] [cfe-branch] r105186 - /cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp

Daniel Dunbar daniel at zuster.org
Sun May 30 16:41:02 PDT 2010


Author: ddunbar
Date: Sun May 30 18:41:02 2010
New Revision: 105186

URL: http://llvm.org/viewvc/llvm-project?rev=105186&view=rev
Log:
Merge r105182:
--
Author: Chris Lattner <clattner at apple.com>
Date:   Sun May 30 23:27:38 2010 +0000

    simpler fix for rdar://8044135 - escaped newlines have already
    been processed, so they don't have to be tip-toed around.

Modified:
    cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp

Modified: cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp?rev=105186&r1=105185&r2=105186&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp Sun May 30 18:41:02 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 llvm-branch-commits mailing list