fix PR5740: a colon is sacred when parsing case statement expressions!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91016 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/RAIIObjectsForParser.h b/lib/Parse/RAIIObjectsForParser.h
index d18d2f8..bacdf29 100644
--- a/lib/Parse/RAIIObjectsForParser.h
+++ b/lib/Parse/RAIIObjectsForParser.h
@@ -50,9 +50,15 @@
P.ColonIsSacred = true;
}
- ~ColonProtectionRAIIObject() {
+ /// restore - This can be used to restore the state early, before the dtor
+ /// is run.
+ void restore() {
P.ColonIsSacred = OldVal;
}
+
+ ~ColonProtectionRAIIObject() {
+ restore();
+ }
};
} // end namespace clang