summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/LiteralSupport.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-03 01:01:56 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-03 01:01:56 +0000
commit4e5b5c36f47c9a406ea7f6b4f89fae477693973a (patch)
tree89c86d0373106580a19eb2d7b39b8ee7a29976f7 /clang/lib/Lex/LiteralSupport.cpp
parent70ef929561421f2ff39f2e5dad7ead2a1343d26f (diff)
downloadbcm5719-llvm-4e5b5c36f47c9a406ea7f6b4f89fae477693973a.tar.gz
bcm5719-llvm-4e5b5c36f47c9a406ea7f6b4f89fae477693973a.zip
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 llvm-svn: 156043
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index c1d228b8798..b01fc1f8c6b 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -1192,7 +1192,12 @@ void StringLiteralParser::init(const Token *StringToks, unsigned NumStringToks){
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
OpenPOWER on IntegriCloud