diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-22 10:23:16 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-22 10:23:16 +0000 |
commit | 21e7ad24099965acfa801e4abdd91e3d94106428 (patch) | |
tree | 5f3ec3b2e4bd25a7330428fb6d15fb68eb0b5cd4 | |
parent | 5ab0640efb436a721d408c853b771932d1a6ffce (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72257 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Parse/Parser.h | 10 | ||||
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 15 |
2 files changed, 12 insertions, 13 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index bc5a3a5adc..69488fcda8 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -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(); diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index c065b4760a..f2a5902e41 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -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, |