summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp b/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp
index 6aeb6fa..3310659 100644
--- a/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp
+++ b/contrib/llvm/tools/clang/lib/Lex/PPCaching.cpp
@@ -45,6 +45,9 @@ void Preprocessor::Backtrack() {
}
void Preprocessor::CachingLex(Token &Result) {
+ if (!InCachingLexMode())
+ return;
+
if (CachedLexPos < CachedTokens.size()) {
Result = CachedTokens[CachedLexPos++];
return;
@@ -60,13 +63,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