diff options
Diffstat (limited to 'include/clang/Parse/RAIIObjectsForParser.h')
-rw-r--r-- | include/clang/Parse/RAIIObjectsForParser.h | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/include/clang/Parse/RAIIObjectsForParser.h b/include/clang/Parse/RAIIObjectsForParser.h index f45d6434833ea..ba5e5fe3c8fb8 100644 --- a/include/clang/Parse/RAIIObjectsForParser.h +++ b/include/clang/Parse/RAIIObjectsForParser.h @@ -49,7 +49,7 @@ namespace clang { bool Active; public: - /// Begin suppressing access-like checks + /// Begin suppressing access-like checks SuppressAccessChecks(Parser &P, bool activate = true) : S(P.getActions()), DiagnosticPool(nullptr) { if (activate) { @@ -264,7 +264,7 @@ namespace clang { Diags.DecrementAllExtensionsSilenced(); } }; - + /// 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. @@ -276,18 +276,18 @@ namespace clang { : P(p), OldVal(P.ColonIsSacred) { P.ColonIsSacred = Value; } - + /// restore - This can be used to restore the state early, before the dtor /// is run. void restore() { P.ColonIsSacred = OldVal; } - + ~ColonProtectionRAIIObject() { restore(); } }; - + /// RAII object that makes '>' behave either as an operator /// or as the closing angle bracket for a template argument list. class GreaterThanIsOperatorScope { @@ -298,28 +298,28 @@ namespace clang { : GreaterThanIsOperator(GTIO), OldGreaterThanIsOperator(GTIO) { GreaterThanIsOperator = Val; } - + ~GreaterThanIsOperatorScope() { GreaterThanIsOperator = OldGreaterThanIsOperator; } }; - + class InMessageExpressionRAIIObject { bool &InMessageExpression; bool OldValue; - + public: InMessageExpressionRAIIObject(Parser &P, bool Value) - : InMessageExpression(P.InMessageExpression), + : InMessageExpression(P.InMessageExpression), OldValue(P.InMessageExpression) { InMessageExpression = Value; } - + ~InMessageExpressionRAIIObject() { InMessageExpression = OldValue; } }; - + /// RAII object that makes sure paren/bracket/brace count is correct /// after declaration/statement parsing, even when there's a parsing error. class ParenBraceBracketBalancer { @@ -329,7 +329,7 @@ namespace clang { ParenBraceBracketBalancer(Parser &p) : P(p), ParenCount(p.ParenCount), BracketCount(p.BracketCount), BraceCount(p.BraceCount) { } - + ~ParenBraceBracketBalancer() { P.AngleBrackets.clear(P); P.ParenCount = ParenCount; @@ -369,7 +369,7 @@ namespace clang { tok::TokenKind Kind, Close, FinalToken; SourceLocation (Parser::*Consumer)(); SourceLocation LOpen, LClose; - + unsigned short &getDepth() { switch (Kind) { case tok::l_brace: return P.BraceCount; @@ -378,10 +378,10 @@ namespace clang { default: llvm_unreachable("Wrong token kind"); } } - + bool diagnoseOverflow(); bool diagnoseMissingClose(); - + public: BalancedDelimiterTracker(Parser& p, tok::TokenKind k, tok::TokenKind FinalToken = tok::semi) @@ -391,34 +391,34 @@ namespace clang { switch (Kind) { default: llvm_unreachable("Unexpected balanced token"); case tok::l_brace: - Close = tok::r_brace; + Close = tok::r_brace; Consumer = &Parser::ConsumeBrace; break; case tok::l_paren: - Close = tok::r_paren; + Close = tok::r_paren; Consumer = &Parser::ConsumeParen; break; - + case tok::l_square: - Close = tok::r_square; + Close = tok::r_square; Consumer = &Parser::ConsumeBracket; break; - } + } } - + SourceLocation getOpenLocation() const { return LOpen; } SourceLocation getCloseLocation() const { return LClose; } SourceRange getRange() const { return SourceRange(LOpen, LClose); } - + bool consumeOpen() { if (!P.Tok.is(Kind)) return true; - + if (getDepth() < P.getLangOpts().BracketDepth) { LOpen = (P.*Consumer)(); return false; } - + return diagnoseOverflow(); } @@ -436,7 +436,7 @@ namespace clang { LClose = (P.*Consumer)(); return false; } - + return diagnoseMissingClose(); } void skipToEnd(); |