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
This commit is contained in:
Argyrios Kyrtzidis 2012-05-03 01:01:56 +00:00
parent 70ef929561
commit 4e5b5c36f4
1 changed files with 6 additions and 1 deletions

View File

@ -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