]> granicus.if.org Git - clang/commitdiff
Add Preprocessor::PushIncludeMacroStack() and Preprocessor::PopIncludeMacroStack...
authorTed Kremenek <kremenek@apple.com>
Wed, 12 Nov 2008 22:10:22 +0000 (22:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 12 Nov 2008 22:10:22 +0000 (22:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59179 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/Preprocessor.h

index c0caee660ebef98f3580e03d7fe5e409568ca123..506038240137b2f1a0fbdb9c0ad778f8db0e15ad 100644 (file)
@@ -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;