summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-12 04:25:32 +0000
committerChris Lattner <sabre@nondot.org>2010-07-12 04:25:32 +0000
commit5a503e9f7068c528ac846d016c6c80aad640ae04 (patch)
treedbd251c6db9d44b32a6516e167527d6faea74cc7 /clang/lib/Lex
parent6635f9838e182dfe805288dc10e83fdfded7c6bb (diff)
downloadbcm5719-llvm-5a503e9f7068c528ac846d016c6c80aad640ae04.tar.gz
bcm5719-llvm-5a503e9f7068c528ac846d016c6c80aad640ae04.zip
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. llvm-svn: 108124
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPCaching.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Lex/PPCaching.cpp b/clang/lib/Lex/PPCaching.cpp
index 6aeb6fa3a2f..20e3b3dd9d8 100644
--- a/clang/lib/Lex/PPCaching.cpp
+++ b/clang/lib/Lex/PPCaching.cpp
@@ -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() {
OpenPOWER on IntegriCloud