Fix use-after-free in r190980.

llvm-svn: 190984
This commit is contained in:
Eli Friedman 2013-09-19 01:51:23 +00:00
parent 0397239f6b
commit 29749d2e3b
1 changed files with 6 additions and 3 deletions

View File

@ -2823,9 +2823,12 @@ bool Lexer::Lex(Token &Result) {
bool atPhysicalStartOfLine = IsAtPhysicalStartOfLine;
IsAtPhysicalStartOfLine = false;
bool result = LexTokenInternal(Result, atPhysicalStartOfLine);
assert((result || !isLexingRawMode()) && "Raw lex must succeed");
return result;
bool isRawLex = isLexingRawMode();
(void) isRawLex;
bool returnedToken = LexTokenInternal(Result, atPhysicalStartOfLine);
// (After the LexTokenInternal call, the lexer might be destroyed.)
assert((returnedToken || !isRawLex) && "Raw lex must succeed");
return returnedToken;
}
/// LexTokenInternal - This implements a simple C family lexer. It is an