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
This commit is contained in:
Chris Lattner 2009-12-10 00:44:03 +00:00
Родитель 6fb09c8acc
Коммит d0d76f1cbe
1 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -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 @@ namespace clang {
}
};
// 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 @@ namespace clang {
}
};
/// \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