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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/RAIIObjectsForParser.h b/lib/Parse/RAIIObjectsForParser.h
index bacdf29..93b9a82 100644
--- a/lib/Parse/RAIIObjectsForParser.h
+++ b/lib/Parse/RAIIObjectsForParser.h
@@ -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 >IO, bool Val)
+ : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) {
+ GreaterThanIsOperator = Val;
+ }
+
+ ~GreaterThanIsOperatorScope() {
+ GreaterThanIsOperator = OldGreaterThanIsOperator;
+ }
+ };
+
} // end namespace clang
#endif