diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-05-17 09:32:05 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-05-17 09:32:05 +0000 |
commit | 929af67361275feafc07d02458af7657f754c029 (patch) | |
tree | 313270960fed57114ddafbab0af5e34292fd1fa5 /clang/lib/Lex/PPCaching.cpp | |
parent | 30b2307da8b244f40d8ec55c0e6818281fb1935f (diff) | |
download | bcm5719-llvm-929af67361275feafc07d02458af7657f754c029.tar.gz bcm5719-llvm-929af67361275feafc07d02458af7657f754c029.zip |
[Lex] Allow to consume tokens while preprocessing
Summary:
By adding a hook to consume all tokens produced by the preprocessor.
The intention of this change is to make it possible to consume the
expanded tokens without re-runnig the preprocessor with minimal changes
to the preprocessor and minimal performance penalty when preprocessing
without recording the tokens.
The added hook is very low-level and reconstructing the expanded token
stream requires more work in the client code, the actual algorithm to
collect the tokens using this hook can be found in the follow-up change.
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: eraman, nemanjai, kbarton, jsji, riccibruno, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59885
llvm-svn: 361007
Diffstat (limited to 'clang/lib/Lex/PPCaching.cpp')
-rw-r--r-- | clang/lib/Lex/PPCaching.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPCaching.cpp b/clang/lib/Lex/PPCaching.cpp index 363a185d3d2..31548d246d5 100644 --- a/clang/lib/Lex/PPCaching.cpp +++ b/clang/lib/Lex/PPCaching.cpp @@ -45,7 +45,7 @@ void Preprocessor::Backtrack() { recomputeCurLexerKind(); } -void Preprocessor::CachingLex(Token &Result, bool &IsNewToken) { +void Preprocessor::CachingLex(Token &Result) { if (!InCachingLexMode()) return; @@ -55,7 +55,7 @@ void Preprocessor::CachingLex(Token &Result, bool &IsNewToken) { if (CachedLexPos < CachedTokens.size()) { Result = CachedTokens[CachedLexPos++]; - IsNewToken = false; + Result.setFlag(Token::IsReinjected); return; } |