forked from OSchip/llvm-project
Remove ParseSimpleParenExpression.
Embed its functionality into it's only user, ParseCXXCasts. CXXCasts now get the "actual" expression directly, they no longer always receive a ParenExpr. This is better since the parentheses are always part of the C++ casts syntax. llvm-svn: 72257
This commit is contained in:
parent
7bd98440b3
commit
387a334656
|
@ -688,16 +688,6 @@ private:
|
|||
OwningExprResult ParseParenExpression(ParenParseOption &ExprType,
|
||||
TypeTy *&CastTy,
|
||||
SourceLocation &RParenLoc);
|
||||
|
||||
OwningExprResult ParseSimpleParenExpression() { // Parse SimpleExpr only.
|
||||
SourceLocation RParenLoc;
|
||||
return ParseSimpleParenExpression(RParenLoc);
|
||||
}
|
||||
OwningExprResult ParseSimpleParenExpression(SourceLocation &RParenLoc) {
|
||||
ParenParseOption Op = SimpleExpr;
|
||||
TypeTy *CastTy;
|
||||
return ParseParenExpression(Op, CastTy, RParenLoc);
|
||||
}
|
||||
|
||||
OwningExprResult ParseStringLiteralExpression();
|
||||
|
||||
|
|
|
@ -322,10 +322,19 @@ Parser::OwningExprResult Parser::ParseCXXCasts() {
|
|||
|
||||
SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
|
||||
|
||||
if (Tok.isNot(tok::l_paren))
|
||||
return ExprError(Diag(Tok, diag::err_expected_lparen_after) << CastName);
|
||||
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after, CastName))
|
||||
return ExprError();
|
||||
|
||||
OwningExprResult Result(ParseSimpleParenExpression(RParenLoc));
|
||||
OwningExprResult Result = ParseExpression();
|
||||
|
||||
// Match the ')'.
|
||||
if (Result.isInvalid())
|
||||
SkipUntil(tok::r_paren);
|
||||
|
||||
if (Tok.is(tok::r_paren))
|
||||
RParenLoc = ConsumeParen();
|
||||
else
|
||||
MatchRHSPunctuation(tok::r_paren, LParenLoc);
|
||||
|
||||
if (!Result.isInvalid() && !CastTy.isInvalid())
|
||||
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
|
||||
|
|
Loading…
Reference in New Issue