[cfe-commits] r59631 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/PPCaching.cpp lib/Lex/Preprocessor.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Wed Nov 19 06:23:17 PST 2008
Author: akirtzidis
Date: Wed Nov 19 08:23:14 2008
New Revision: 59631
URL: http://llvm.org/viewvc/llvm-project?rev=59631&view=rev
Log:
Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().
Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/PPCaching.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=59631&r1=59630&r2=59631&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Nov 19 08:23:14 2008
@@ -73,9 +73,6 @@
bool DisableMacroExpansion : 1; // True if macro expansion is disabled.
bool InMacroArgs : 1; // True if parsing fn macro invocation args.
- /// CacheTokens - True when the lexed tokens are cached for backtracking.
- bool CacheTokens : 1;
-
/// Identifiers - This is mapping/lookup information for all identifiers in
/// the program, including program keywords.
IdentifierTable Identifiers;
@@ -323,7 +320,7 @@
/// isBacktrackEnabled - True if EnableBacktrackAtThisPos() was called and
/// caching of tokens is on.
- bool isBacktrackEnabled() const { return CacheTokens; }
+ bool isBacktrackEnabled() const { return !BacktrackPositions.empty(); }
/// Lex - To lex a token from the preprocessor, just pull a token from the
/// current lexer or macro object.
Modified: cfe/trunk/lib/Lex/PPCaching.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPCaching.cpp?rev=59631&r1=59630&r2=59631&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPCaching.cpp (original)
+++ cfe/trunk/lib/Lex/PPCaching.cpp Wed Nov 19 08:23:14 2008
@@ -24,7 +24,6 @@
/// be called multiple times and CommitBacktrackedTokens/Backtrack calls will
/// be combined with the EnableBacktrackAtThisPos calls in reverse order.
void Preprocessor::EnableBacktrackAtThisPos() {
- CacheTokens = true;
BacktrackPositions.push_back(CachedLexPos);
EnterCachingLexMode();
}
@@ -34,7 +33,6 @@
assert(!BacktrackPositions.empty()
&& "EnableBacktrackAtThisPos was not called!");
BacktrackPositions.pop_back();
- CacheTokens = !BacktrackPositions.empty();
}
/// Backtrack - Make Preprocessor re-lex the tokens that were lexed since
@@ -44,7 +42,6 @@
&& "EnableBacktrackAtThisPos was not called!");
CachedLexPos = BacktrackPositions.back();
BacktrackPositions.pop_back();
- CacheTokens = !BacktrackPositions.empty();
}
void Preprocessor::CachingLex(Token &Result) {
@@ -56,7 +53,7 @@
ExitCachingLexMode();
Lex(Result);
- if (!CacheTokens) {
+ if (!isBacktrackEnabled()) {
// All cached tokens were consumed.
CachedTokens.clear();
CachedLexPos = 0;
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=59631&r1=59630&r2=59631&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Nov 19 08:23:14 2008
@@ -69,7 +69,6 @@
InMacroArgs = false;
NumCachedTokenLexers = 0;
- CacheTokens = false;
CachedLexPos = 0;
// "Poison" __VA_ARGS__, which can only appear in the expansion of a macro.
More information about the cfe-commits
mailing list