diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-15 02:43:47 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-15 02:43:47 +0000 |
commit | 87e11a426dd5b36e2183db7885ee135922c5bfa8 (patch) | |
tree | 91d86e64e9ef6c3f42b2a59fb1ffb05c9c135d8f /clang/lib/Parse/ParseExpr.cpp | |
parent | 4971b40d7e14fade6eb161dc5fb37f8a22ca4c73 (diff) | |
download | bcm5719-llvm-87e11a426dd5b36e2183db7885ee135922c5bfa8.tar.gz bcm5719-llvm-87e11a426dd5b36e2183db7885ee135922c5bfa8.zip |
PR19748: Make sure we don't lose colon protection after the parenthesized type-id in a cast-expression.
llvm-svn: 208843
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index eea475f869d..e69a213247f 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -641,15 +641,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, : CastExpr; ParsedType CastTy; SourceLocation RParenLoc; - - { - // The inside of the parens don't need to be a colon protected scope, and - // isn't immediately a message send. - ColonProtectionRAIIObject X(*this, false); - - Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/, - isTypeCast == IsTypeCast, CastTy, RParenLoc); - } + Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/, + isTypeCast == IsTypeCast, CastTy, RParenLoc); switch (ParenExprType) { case SimpleExpr: break; // Nothing else to do. @@ -1928,6 +1921,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, bool isTypeCast, ParsedType &CastTy, SourceLocation &RParenLoc) { assert(Tok.is(tok::l_paren) && "Not a paren expr!"); + ColonProtectionRAIIObject ColonProtection(*this, false); BalancedDelimiterTracker T(*this, tok::l_paren); if (T.consumeOpen()) return ExprError(); @@ -2003,6 +1997,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, TypeResult Ty = ParseTypeName(); T.consumeClose(); + ColonProtection.restore(); RParenLoc = T.getCloseLocation(); ExprResult SubExpr = ParseCastExpression(/*isUnaryExpression=*/false); @@ -2023,7 +2018,8 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // if stopIfCastExpr is false, we need to determine the context past the // parens, so we defer to ParseCXXAmbiguousParenExpression for that. if (isAmbiguousTypeId && !stopIfCastExpr) { - ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy, T); + ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy, T, + ColonProtection); RParenLoc = T.getCloseLocation(); return res; } @@ -2051,6 +2047,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, } else { // Match the ')'. T.consumeClose(); + ColonProtection.restore(); RParenLoc = T.getCloseLocation(); if (Tok.is(tok::l_brace)) { ExprType = CompoundLiteral; |