[cfe-commits] r59179 - /cfe/trunk/include/clang/Lex/Preprocessor.h

Ted Kremenek kremenek at apple.com
Wed Nov 12 14:10:45 PST 2008


Author: kremenek
Date: Wed Nov 12 16:10:22 2008
New Revision: 59179

URL: http://llvm.org/viewvc/llvm-project?rev=59179&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Lex/Preprocessor.h

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=59179&r1=59178&r2=59179&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Nov 12 16:10:22 2008
@@ -327,7 +327,7 @@
       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 @@
   /// 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;





More information about the cfe-commits mailing list