Skip to content
Snippets Groups Projects
Commit 63dae6e5 authored by Chris Lattner's avatar Chris Lattner
Browse files

we do in fact have to cache the EOF token returned by the preprocessor.

In the case of backtracking, the cached token lexer will be the only 
lexer on the stack, without this the token stack will be empty and EOF
won't be returned.

This fixes PR7072.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108124 91177308-0d34-0410-b5e6-96231b3b80d8
parent 9fc1873a
No related branches found
No related tags found
No related merge requests found
......@@ -60,13 +60,10 @@ void Preprocessor::CachingLex(Token &Result) {
return;
}
// We should cache the lexed token.
// Cache the lexed token.
EnterCachingLexMode();
if (Result.isNot(tok::eof)) {
CachedTokens.push_back(Result);
++CachedLexPos;
}
CachedTokens.push_back(Result);
++CachedLexPos;
}
void Preprocessor::EnterCachingLexMode() {
......
// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
// PR7072
()( // expected-error {{expected unqualified-id}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment