[cfe-commits] r156043 - /cfe/trunk/lib/Lex/LiteralSupport.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed May 2 18:01:56 PDT 2012


Author: akirtzidis
Date: Wed May  2 20:01:56 2012
New Revision: 156043

URL: http://llvm.org/viewvc/llvm-project?rev=156043&view=rev
Log:
In StringLiteralParser::init(), fail gracefully if the string is
not as we expect; it may be due to racing issue of a file coming from PCH
changing after the PCH is loaded.

rdar://11353109

Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=156043&r1=156042&r2=156043&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Wed May  2 20:01:56 2012
@@ -1192,7 +1192,12 @@
         if (DiagnoseBadString(StringToks[i]))
           hadError = true;
     } else {
-      assert(ThisTokBuf[0] == '"' && "Expected quote, lexer broken?");
+      if (ThisTokBuf[0] != '"') {
+        // The file may have come from PCH and then changed after loading the
+        // PCH; Fail gracefully.
+        hadError = true;
+        continue;
+      }
       ++ThisTokBuf; // skip "
 
       // Check if this is a pascal string





More information about the cfe-commits mailing list