diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-08-10 13:15:22 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-08-10 13:15:22 +0000 |
commit | 03db1b31dd926409b7defc1c90b66549464652c0 (patch) | |
tree | ea9d1600a9098e36c5ec0da6632e44180d1ad9d4 /lib/Lex/Preprocessor.cpp | |
parent | 9ca8bb0996bbb8b9dbf69c51cb3d1523559e47e3 (diff) |
Allow the preprocessor to cache the lexed tokens, so that we can do efficient lookahead and backtracking.
1) New public methods added:
-EnableBacktrackAtThisPos
-DisableBacktrack
-Backtrack
-isBacktrackEnabled
2) LookAhead() implementation is replaced with a more efficient one.
3) LookNext() is removed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 631b8361e9..33c94b6e8a 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -68,6 +68,9 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, InMacroArgs = false; NumCachedTokenLexers = 0; + CacheTokens = false; + CachedLexPos = 0; + // "Poison" __VA_ARGS__, which can only appear in the expansion of a macro. // This gets unpoisoned where it is allowed. (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned(); @@ -579,4 +582,3 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { if (II.isExtensionToken() && Features.C99) Diag(Identifier, diag::ext_token_used); } - |