[cfe-commits] r91023 - /cfe/trunk/lib/Parse/RAIIObjectsForParser.h

Chris Lattner sabre at nondot.org
Wed Dec 9 16:44:03 PST 2009


Author: lattner
Date: Wed Dec  9 18:44:03 2009
New Revision: 91023

URL: http://llvm.org/viewvc/llvm-project?rev=91023&view=rev
Log:
move GreaterThanIsOperatorScope into RAIIObjectsForParser.  Add some more
TODOs for other classes that could be moved out of Parser.h.  I don't plan
to do these in the near term though.

Modified:
    cfe/trunk/lib/Parse/RAIIObjectsForParser.h

Modified: cfe/trunk/lib/Parse/RAIIObjectsForParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/RAIIObjectsForParser.h?rev=91023&r1=91022&r2=91023&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/RAIIObjectsForParser.h (original)
+++ cfe/trunk/lib/Parse/RAIIObjectsForParser.h Wed Dec  9 18:44:03 2009
@@ -18,7 +18,11 @@
 #include "clang/Parse/ParseDiagnostic.h"
 
 namespace clang {
-
+  // TODO: move ParsingDeclRAIIObject here.
+  // TODO: move ParsingClassDefinition here.
+  // TODO: move TentativeParsingAction here.
+  
+  
   /// ExtensionRAIIObject - This saves the state of extension warnings when
   /// constructed and disables them.  When destructed, it restores them back to
   /// the way they used to be.  This is used to handle __extension__ in the
@@ -37,8 +41,6 @@
     }
   };
   
-  // TODO: move GreaterThanIsOperatorScope here.
-  
   /// ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and
   /// restores it when destroyed.  This says that "foo:" should not be
   /// considered a possible typo for "foo::" for error recovery purposes.
@@ -61,6 +63,22 @@
     }
   };
   
+  /// \brief RAII object that makes '>' behave either as an operator
+  /// or as the closing angle bracket for a template argument list.
+  struct GreaterThanIsOperatorScope {
+    bool &GreaterThanIsOperator;
+    bool OldGreaterThanIsOperator;
+    
+    GreaterThanIsOperatorScope(bool &GTIO, bool Val)
+    : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) {
+      GreaterThanIsOperator = Val;
+    }
+    
+    ~GreaterThanIsOperatorScope() {
+      GreaterThanIsOperator = OldGreaterThanIsOperator;
+    }
+  };
+  
 } // end namespace clang
 
 #endif





More information about the cfe-commits mailing list