diff options
Diffstat (limited to 'lib/Parse/RAIIObjectsForParser.h')
-rw-r--r-- | lib/Parse/RAIIObjectsForParser.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Parse/RAIIObjectsForParser.h b/lib/Parse/RAIIObjectsForParser.h index d642da58d5..d18d2f8026 100644 --- a/lib/Parse/RAIIObjectsForParser.h +++ b/lib/Parse/RAIIObjectsForParser.h @@ -36,6 +36,25 @@ namespace clang { Diags.DecrementAllExtensionsSilenced(); } }; -} + + // 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. + class ColonProtectionRAIIObject { + Parser &P; + bool OldVal; + public: + ColonProtectionRAIIObject(Parser &p) : P(p), OldVal(P.ColonIsSacred) { + P.ColonIsSacred = true; + } + + ~ColonProtectionRAIIObject() { + P.ColonIsSacred = OldVal; + } + }; + +} // end namespace clang #endif |