diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-12 22:10:22 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-12 22:10:22 +0000 |
commit | d038def6e3f33bebf8c12bb3a95b2492c154a5dd (patch) | |
tree | 909535d0164e32b14d2ebff1acf7989ecae2c937 | |
parent | bfcb712627b9346ab92880d9075896dcc7700ac2 (diff) |
Add Preprocessor::PushIncludeMacroStack() and Preprocessor::PopIncludeMacroStack(), two utility methods for manipulating the Preprocessor stack. These will be used to remove manually manipulation of IncludeMacroStack from the rest of the Preprocessor implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59179 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index c0caee660e..5060382401 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -327,7 +327,7 @@ public: Lex(Result); while (Result.getKind() == tok::comment); } - + /// LexUnexpandedToken - This is just like Lex, but this disables macro /// expansion of identifier tokens. void LexUnexpandedToken(Token &Result) { @@ -482,6 +482,21 @@ public: /// not, emit a diagnostic and consume up until the eom. void CheckEndOfDirective(const char *Directive); private: + + void PushIncludeMacroStack() { + IncludeMacroStack.push_back(IncludeStackInfo(CurLexer, CurDirLookup, + CurTokenLexer) { + CurLexer = 0; + CurTokenLexer = 0; + } + + void PopIncludeMacroStack() { + CurLexer = IncludeMacroStack.back().TheLexer; + CurDirLookup = IncludeMacroStack.back().TheDirLookup; + CurTokenLexer = IncludeMacroStack.back().TheTokenLexer; + IncludeMacroStack.pop_back(); + } + /// isInPrimaryFile - Return true if we're in the top-level file, not in a /// #include. bool isInPrimaryFile() const; |