[cfe-commits] r60900 - in /cfe/trunk: include/clang/Parse/Ownership.h include/clang/Parse/Parser.h lib/Parse/ParseDecl.cpp lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/ParseInit.cpp lib/Parse/ParseObjc.cpp lib/Parse/ParseStmt.cpp
Howard Hinnant
hhinnant at apple.com
Fri Dec 12 13:52:51 PST 2008
I'm afraid I don't have access to Windows. Is there a compiler switch
you could try that is along the lines of "stress conformance instead
of backwards compatibility"?
-Howard
On Dec 12, 2008, at 4:49 PM, steve naroff wrote:
> Hi Sebastian,
>
> Your recent smart pointer work isn't happy on Windows.
>
> I get 52 identical errors that all say
> 'clang::ASTOwningResult<Destroyer>::operator =': cannot access private
> member declared in class 'clang::ASTOwningResult<Destroyer>'
>
> Please advise - thanks,
>
> snaroff
>
> On Dec 11, 2008, at 4:37 PM, Sebastian Redl wrote:
>
>> Author: cornedbee
>> Date: Thu Dec 11 15:36:32 2008
>> New Revision: 60900
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=60900&view=rev
>> Log:
>> Convert selected expression parsers to use smart pointers.
>>
>> Modified:
>> cfe/trunk/include/clang/Parse/Ownership.h
>> cfe/trunk/include/clang/Parse/Parser.h
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Parse/ParseExpr.cpp
>> cfe/trunk/lib/Parse/ParseExprCXX.cpp
>> cfe/trunk/lib/Parse/ParseInit.cpp
>> cfe/trunk/lib/Parse/ParseObjc.cpp
>> cfe/trunk/lib/Parse/ParseStmt.cpp
>>
>> Modified: cfe/trunk/include/clang/Parse/Ownership.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Ownership.h?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/include/clang/Parse/Ownership.h (original)
>> +++ cfe/trunk/include/clang/Parse/Ownership.h Thu Dec 11 15:36:32
>> 2008
>> @@ -150,12 +150,6 @@
>> public:
>> typedef ActionBase::ActionResult<DestroyerToUID<Destroyer>::UID>
>> DumbResult;
>>
>> - // For convenience and compatibility.
>> - ASTOwningResult(bool invalid = false)
>> - : Actions(0), Node(0), Invalid(invalid) {}
>> - // Same
>> - ASTOwningResult(const DiagnosticBuilder &)
>> - : Actions(0), Node(0), Invalid(true) {}
>> explicit ASTOwningResult(ActionBase &actions, bool invalid =
>> false)
>> : Actions(&actions), Node(0), Invalid(invalid) {}
>> ASTOwningResult(ActionBase &actions, void *node)
>>
>> Modified: cfe/trunk/include/clang/Parse/Parser.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/include/clang/Parse/Parser.h (original)
>> +++ cfe/trunk/include/clang/Parse/Parser.h Thu Dec 11 15:36:32 2008
>> @@ -98,6 +98,8 @@
>>
>> OwningExprResult ExprError() { return OwningExprResult(Actions,
>> true); }
>> OwningStmtResult StmtError() { return OwningStmtResult(Actions,
>> true); }
>> + OwningExprResult ExprError(const DiagnosticBuilder &) { return
>> ExprError(); }
>> + OwningStmtResult StmtError(const DiagnosticBuilder &) { return
>> StmtError(); }
>>
>> // Parsing methods.
>>
>> @@ -479,15 +481,16 @@
>> //
>> =
>> =
>> =--------------------------------------------------------------------
>> ===//
>> // C99 6.5: Expressions.
>>
>> - ExprResult ParseExpression();
>> - ExprResult ParseConstantExpression();
>> - ExprResult ParseAssignmentExpression(); // Expr that doesn't
>> include commas.
>> -
>> + OwningExprResult ParseExpression();
>> + OwningExprResult ParseConstantExpression();
>> + // Expr that doesn't include commas.
>> + OwningExprResult ParseAssignmentExpression();
>> +
>> ExprResult ParseExpressionWithLeadingAt(SourceLocation AtLoc);
>>
>> ExprResult ParseRHSOfBinaryExpression(ExprResult LHS, unsigned
>> MinPrec);
>> - ExprResult ParseCastExpression(bool isUnaryExpression);
>> - ExprResult ParsePostfixExpressionSuffix(ExprResult LHS);
>> + OwningExprResult ParseCastExpression(bool isUnaryExpression);
>> + OwningExprResult ParsePostfixExpressionSuffix(OwningExprResult
>> LHS);
>> ExprResult ParseSizeofAlignofExpression();
>> ExprResult ParseBuiltinPrimaryExpression();
>>
>> @@ -568,7 +571,7 @@
>>
>> //
>> =
>> =
>> =--------------------------------------------------------------------
>> ===//
>> // C++ if/switch/while/for condition expression.
>> - ExprResult ParseCXXCondition();
>> + OwningExprResult ParseCXXCondition();
>>
>> //
>> =
>> =
>> =--------------------------------------------------------------------
>> ===//
>> // C++ types
>> @@ -582,7 +585,7 @@
>> /// '{' ...
>> ExprResult ParseInitializer() {
>> if (Tok.isNot(tok::l_brace))
>> - return ParseAssignmentExpression();
>> + return ParseAssignmentExpression().result();
>> return ParseBraceInitializer();
>> }
>> ExprResult ParseBraceInitializer();
>>
>> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Dec 11 15:36:32 2008
>> @@ -126,7 +126,7 @@
>>
>> // now parse the non-empty comma separated list of
>> expressions
>> while (1) {
>> - OwningExprResult ArgExpr(Actions,
>> ParseAssignmentExpression());
>> + OwningExprResult ArgExpr(ParseAssignmentExpression());
>> if (ArgExpr.isInvalid()) {
>> ArgExprsOk = false;
>> SkipUntil(tok::r_paren);
>> @@ -158,7 +158,7 @@
>>
>> // now parse the list of expressions
>> while (1) {
>> - OwningExprResult ArgExpr(Actions,
>> ParseAssignmentExpression());
>> + OwningExprResult ArgExpr(ParseAssignmentExpression());
>> if (ArgExpr.isInvalid()) {
>> ArgExprsOk = false;
>> SkipUntil(tok::r_paren);
>> @@ -842,7 +842,7 @@
>>
>> if (Tok.is(tok::colon)) {
>> ConsumeToken();
>> - OwningExprResult Res(Actions, ParseConstantExpression());
>> + OwningExprResult Res(ParseConstantExpression());
>> if (Res.isInvalid())
>> SkipUntil(tok::semi, true, true);
>> else
>> @@ -1796,7 +1796,7 @@
>> ConsumeToken();
>>
>> // Parse the default argument
>> - OwningExprResult DefArgResult(Actions,
>> ParseAssignmentExpression());
>> + OwningExprResult DefArgResult(ParseAssignmentExpression());
>> if (DefArgResult.isInvalid()) {
>> SkipUntil(tok::comma, tok::r_paren, true, true);
>> } else {
>> @@ -1992,8 +1992,7 @@
>> return;
>> }
>>
>> - OwningExprResult Result(Actions,
>> - ParseCastExpression(true/
>> *isUnaryExpression*/));
>> + OwningExprResult Result(ParseCastExpression(true/
>> *isUnaryExpression*/));
>> if (Result.isInvalid())
>> return;
>>
>> @@ -2025,7 +2024,7 @@
>> if (DS.SetTypeSpecType(DeclSpec::TST_typeofType, StartLoc,
>> PrevSpec, Ty))
>> Diag(StartLoc, diag::err_invalid_decl_spec_combination) <<
>> PrevSpec;
>> } else { // we have an expression.
>> - OwningExprResult Result(Actions, ParseExpression());
>> + OwningExprResult Result(ParseExpression());
>>
>> if (Result.isInvalid() || Tok.isNot(tok::r_paren)) {
>> MatchRHSPunctuation(tok::r_paren, LParenLoc);
>>
>> Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseExpr.cpp Thu Dec 11 15:36:32 2008
>> @@ -169,14 +169,14 @@
>> /// assignment-expression
>> /// expression ',' assignment-expression
>> ///
>> -Parser::ExprResult Parser::ParseExpression() {
>> +Parser::OwningExprResult Parser::ParseExpression() {
>> if (Tok.is(tok::kw_throw))
>> - return ParseThrowExpression();
>> + return Owned(ParseThrowExpression());
>>
>> - OwningExprResult LHS(Actions, ParseCastExpression(false));
>> - if (LHS.isInvalid()) return LHS.result();
>> -
>> - return ParseRHSOfBinaryExpression(LHS.result(), prec::Comma);
>> + OwningExprResult LHS(ParseCastExpression(false));
>> + if (LHS.isInvalid()) return move(LHS);
>> +
>> + return Owned(ParseRHSOfBinaryExpression(LHS.result(),
>> prec::Comma));
>> }
>>
>> /// This routine is called when the '@' is seen and consumed.
>> @@ -193,14 +193,14 @@
>>
>> /// ParseAssignmentExpression - Parse an expr that doesn't include
>> commas.
>> ///
>> -Parser::ExprResult Parser::ParseAssignmentExpression() {
>> +Parser::OwningExprResult Parser::ParseAssignmentExpression() {
>> if (Tok.is(tok::kw_throw))
>> - return ParseThrowExpression();
>> + return Owned(ParseThrowExpression());
>>
>> - OwningExprResult LHS(Actions, ParseCastExpression(false));
>> - if (LHS.isInvalid()) return LHS.result();
>> -
>> - return ParseRHSOfBinaryExpression(LHS.result(), prec::Assignment);
>> + OwningExprResult LHS(ParseCastExpression(false));
>> + if (LHS.isInvalid()) return move(LHS);
>> +
>> + return Owned(ParseRHSOfBinaryExpression(LHS.result(),
>> prec::Assignment));
>> }
>>
>> /// ParseAssignmentExprWithObjCMessageExprStart - Parse an
>> assignment expression
>> @@ -220,17 +220,17 @@
>>
>> ReceiverName,
>>
>> ReceiverExpr));
>> if (R.isInvalid()) return R.result();
>> - R = ParsePostfixExpressionSuffix(R.result());
>> + R = ParsePostfixExpressionSuffix(move(R));
>> if (R.isInvalid()) return R.result();
>> return ParseRHSOfBinaryExpression(R.result(), 2);
>> }
>>
>>
>> -Parser::ExprResult Parser::ParseConstantExpression() {
>> - OwningExprResult LHS(Actions, ParseCastExpression(false));
>> - if (LHS.isInvalid()) return LHS.result();
>> -
>> - return ParseRHSOfBinaryExpression(LHS.result(),
>> prec::Conditional);
>> +Parser::OwningExprResult Parser::ParseConstantExpression() {
>> + OwningExprResult LHS(ParseCastExpression(false));
>> + if (LHS.isInvalid()) return move(LHS);
>> +
>> + return Owned(ParseRHSOfBinaryExpression(LHS.result(),
>> prec::Conditional));
>> }
>>
>> /// ParseRHSOfBinaryExpression - Parse a binary expression that
>> starts with
>> @@ -281,7 +281,7 @@
>> }
>>
>> // Parse another leaf here for the RHS of the operator.
>> - OwningExprResult RHS(Actions, ParseCastExpression(false));
>> + OwningExprResult RHS(ParseCastExpression(false));
>> if (RHS.isInvalid())
>> return RHS.result();
>>
>> @@ -410,7 +410,7 @@
>> /// '::'[opt] 'delete' cast-expression
>> /// '::'[opt] 'delete' '[' ']' cast-expression
>> ///
>> -Parser::ExprResult Parser::ParseCastExpression(bool
>> isUnaryExpression) {
>> +Parser::OwningExprResult Parser::ParseCastExpression(bool
>> isUnaryExpression) {
>> if (getLang().CPlusPlus) {
>> // Annotate typenames and C++ scope specifiers.
>> // Used only in C++, where the typename can be considered as a
>> functional
>> @@ -444,7 +444,7 @@
>> SourceLocation LParenLoc = Tok.getLocation();
>> SourceLocation RParenLoc;
>> Res = ParseParenExpression(ParenExprType, CastTy, RParenLoc);
>> - if (Res.isInvalid()) return Res.result();
>> + if (Res.isInvalid()) return move(Res);
>>
>> switch (ParenExprType) {
>> case SimpleExpr: break; // Nothing else to do.
>> @@ -461,27 +461,27 @@
>> if (!Res.isInvalid())
>> Res = Actions.ActOnCastExpr(LParenLoc, CastTy, RParenLoc,
>> Res.release());
>> - return Res.result();
>> + return move(Res);
>> }
>>
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> }
>>
>> // primary-expression
>> case tok::numeric_constant:
>> // constant: integer-constant
>> // constant: floating-constant
>> -
>> +
>> Res = Actions.ActOnNumericConstant(Tok);
>> ConsumeToken();
>> -
>> +
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>>
>> case tok::kw_true:
>> case tok::kw_false:
>> - return ParseCXXBoolLiteral();
>> + return Owned(ParseCXXBoolLiteral());
>>
>> case tok::identifier: { // primary-expression: identifier
>> // unqualified-id: identifier
>> @@ -495,42 +495,43 @@
>> SourceLocation L = ConsumeToken();
>> Res = Actions.ActOnIdentifierExpr(CurScope, L, II,
>> Tok.is(tok::l_paren));
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> }
>> case tok::char_constant: // constant: character-constant
>> Res = Actions.ActOnCharacterConstant(Tok);
>> ConsumeToken();
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> case tok::kw___func__: // primary-expression: __func__ [C99
>> 6.4.2.2]
>> case tok::kw___FUNCTION__: // primary-expression: __FUNCTION__
>> [GNU]
>> case tok::kw___PRETTY_FUNCTION__: // primary-expression:
>> __P..Y_F..N__ [GNU]
>> Res = Actions.ActOnPredefinedExpr(Tok.getLocation(), SavedKind);
>> ConsumeToken();
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> case tok::string_literal: // primary-expression: string-literal
>> case tok::wide_string_literal:
>> Res = ParseStringLiteralExpression();
>> - if (Res.isInvalid()) return Res.result();
>> + if (Res.isInvalid()) return move(Res);
>> // This can be followed by postfix-expr pieces (e.g. "foo"[1]).
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> case tok::kw___builtin_va_arg:
>> case tok::kw___builtin_offsetof:
>> case tok::kw___builtin_choose_expr:
>> case tok::kw___builtin_overload:
>> case tok::kw___builtin_types_compatible_p:
>> - return ParseBuiltinPrimaryExpression();
>> + return Owned(ParseBuiltinPrimaryExpression());
>> case tok::kw___null:
>> - return Actions.ActOnGNUNullExpr(ConsumeToken());
>> + return Owned(Actions.ActOnGNUNullExpr(ConsumeToken()));
>> break;
>> case tok::plusplus: // unary-expression: '++' unary-expression
>> case tok::minusminus: { // unary-expression: '--' unary-expression
>> SourceLocation SavedLoc = ConsumeToken();
>> Res = ParseCastExpression(true);
>> if (!Res.isInvalid())
>> - Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind,
>> Res.release());
>> - return Res.result();
>> + Res = Owned(Actions.ActOnUnaryOp(CurScope, SavedLoc,
>> SavedKind,
>> + Res.release()));
>> + return move(Res);
>> }
>> case tok::amp: // unary-expression: '&' cast-expression
>> case tok::star: // unary-expression: '*' cast-expression
>> @@ -544,7 +545,7 @@
>> Res = ParseCastExpression(false);
>> if (!Res.isInvalid())
>> Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind,
>> Res.release());
>> - return Res.result();
>> + return move(Res);
>> }
>>
>> case tok::kw___extension__:{//unary-expression:'__extension__'
>> cast-expr [GNU]
>> @@ -554,7 +555,7 @@
>> Res = ParseCastExpression(false);
>> if (!Res.isInvalid())
>> Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind,
>> Res.release());
>> - return Res.result();
>> + return move(Res);
>> }
>> case tok::kw_sizeof: // unary-expression: 'sizeof' unary-
>> expression
>> // unary-expression: 'sizeof' '(' type-
>> name ')'
>> @@ -562,19 +563,17 @@
>> case tok::kw___alignof: // unary-expression: '__alignof' unary-
>> expression
>> // unary-expression: '__alignof' '(' type-
>> name ')'
>> // unary-expression: 'alignof' '(' type-
>> id ')'
>> - return ParseSizeofAlignofExpression();
>> + return Owned(ParseSizeofAlignofExpression());
>> case tok::ampamp: { // unary-expression: '&&' identifier
>> SourceLocation AmpAmpLoc = ConsumeToken();
>> - if (Tok.isNot(tok::identifier)) {
>> - Diag(Tok, diag::err_expected_ident);
>> - return ExprResult(true);
>> - }
>> + if (Tok.isNot(tok::identifier))
>> + return ExprError(Diag(Tok, diag::err_expected_ident));
>>
>> Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
>> Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(),
>> Tok.getIdentifierInfo());
>> ConsumeToken();
>> - return Res.result();
>> + return move(Res);
>> }
>> case tok::kw_const_cast:
>> case tok::kw_dynamic_cast:
>> @@ -582,15 +581,15 @@
>> case tok::kw_static_cast:
>> Res = ParseCXXCasts();
>> // These can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> case tok::kw_typeid:
>> Res = ParseCXXTypeid();
>> // This can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> case tok::kw_this:
>> Res = ParseCXXThis();
>> // This can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>>
>> case tok::kw_char:
>> case tok::kw_wchar_t:
>> @@ -613,54 +612,54 @@
>> DeclSpec DS;
>> ParseCXXSimpleTypeSpecifier(DS);
>> if (Tok.isNot(tok::l_paren))
>> - return Diag(Tok, diag::err_expected_lparen_after_type)
>> - << DS.getSourceRange();
>> + return ExprError(Diag(Tok,
>> diag::err_expected_lparen_after_type)
>> + << DS.getSourceRange());
>>
>> Res = ParseCXXTypeConstructExpression(DS);
>> // This can be followed by postfix-expr pieces.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>> }
>>
>> case tok::annot_cxxscope: // [C++] id-expression: qualified-id
>> case tok::kw_operator: // [C++] id-expression: operator/conversion-
>> function-id
>> // template-id
>> Res = ParseCXXIdExpression();
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res));
>>
>> case tok::coloncolon: // [C++] new-expression or [C++] delete-
>> expression
>> // If the next token is neither 'new' nor 'delete', the :: would
>> have been
>> // parsed as a scope specifier already.
>> if (NextToken().is(tok::kw_new))
>> - return ParseCXXNewExpression();
>> + return Owned(ParseCXXNewExpression());
>> else
>> - return ParseCXXDeleteExpression();
>> + return Owned(ParseCXXDeleteExpression());
>>
>> case tok::kw_new: // [C++] new-expression
>> - return ParseCXXNewExpression();
>> + return Owned(ParseCXXNewExpression());
>>
>> case tok::kw_delete: // [C++] delete-expression
>> - return ParseCXXDeleteExpression();
>> + return Owned(ParseCXXDeleteExpression());
>>
>> case tok::at: {
>> SourceLocation AtLoc = ConsumeToken();
>> - return ParseObjCAtExpression(AtLoc);
>> + return Owned(ParseObjCAtExpression(AtLoc));
>> }
>> case tok::l_square:
>> // These can be followed by postfix-expr pieces.
>> if (getLang().ObjC1)
>> - return
>> ParsePostfixExpressionSuffix(ParseObjCMessageExpression());
>> + return
>> ParsePostfixExpressionSuffix(Owned(ParseObjCMessageExpression()));
>> // FALL THROUGH.
>> case tok::caret:
>> if (getLang().Blocks)
>> - return
>> ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
>> + return
>> ParsePostfixExpressionSuffix(Owned(ParseBlockLiteralExpression()));
>> Diag(Tok, diag::err_expected_expression);
>> - return ExprResult(true);
>> + return ExprError();
>> default:
>> UnhandledToken:
>> Diag(Tok, diag::err_expected_expression);
>> - return ExprResult(true);
>> + return ExprError();
>> }
>> -
>> +
>> // unreachable.
>> abort();
>> }
>> @@ -683,18 +682,18 @@
>> /// argument-expression
>> /// argument-expression-list ',' assignment-expression
>> ///
>> -Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult
>> LHSArg) {
>> - OwningExprResult LHS(Actions, LHSArg);
>> +Parser::OwningExprResult
>> +Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
>> // Now that the primary-expression piece of the postfix-expression
>> has been
>> // parsed, see if there are any postfix-expression pieces here.
>> SourceLocation Loc;
>> while (1) {
>> switch (Tok.getKind()) {
>> default: // Not a postfix-expression suffix.
>> - return LHS.result();
>> + return move(LHS);
>> case tok::l_square: { // postfix-expression: p-e '[' expression
>> ']'
>> Loc = ConsumeBracket();
>> - OwningExprResult Idx(Actions, ParseExpression());
>> + OwningExprResult Idx(ParseExpression());
>>
>> SourceLocation RLoc = Tok.getLocation();
>>
>> @@ -702,7 +701,7 @@
>> LHS = Actions.ActOnArraySubscriptExpr(CurScope,
>> LHS.release(), Loc,
>> Idx.release(), RLoc);
>> } else
>> - LHS = ExprResult(true);
>> + LHS = ExprError();
>>
>> // Match the ']'.
>> MatchRHSPunctuation(tok::r_square, Loc);
>> @@ -712,16 +711,16 @@
>> case tok::l_paren: { // p-e: p-e '(' argument-expression-
>> list[opt] ')'
>> ExprVector ArgExprs(Actions);
>> CommaLocsTy CommaLocs;
>> -
>> +
>> Loc = ConsumeParen();
>> -
>> +
>> if (Tok.isNot(tok::r_paren)) {
>> if (ParseExpressionList(ArgExprs, CommaLocs)) {
>> SkipUntil(tok::r_paren);
>> - return ExprResult(true);
>> + return ExprError();
>> }
>> }
>> -
>> +
>> // Match the ')'.
>> if (!LHS.isInvalid() && Tok.is(tok::r_paren)) {
>> assert((ArgExprs.size() == 0 || ArgExprs.size()-1 ==
>> CommaLocs.size())&&
>> @@ -731,7 +730,7 @@
>> ArgExprs.size(), &CommaLocs[0],
>> Tok.getLocation());
>> }
>> -
>> +
>> MatchRHSPunctuation(tok::r_paren, Loc);
>> break;
>> }
>> @@ -739,12 +738,12 @@
>> case tok::period: { // postfix-expression: p-e '.' identifier
>> tok::TokenKind OpKind = Tok.getKind();
>> SourceLocation OpLoc = ConsumeToken(); // Eat the "." or "->"
>> token.
>> -
>> +
>> if (Tok.isNot(tok::identifier)) {
>> Diag(Tok, diag::err_expected_ident);
>> - return ExprResult(true);
>> + return ExprError();
>> }
>> -
>> +
>> if (!LHS.isInvalid()) {
>> LHS = Actions.ActOnMemberReferenceExpr(LHS.release(), OpLoc,
>> OpKind,
>> Tok.getLocation(),
>> @@ -805,7 +804,7 @@
>> // If this is a parenthesized expression, it is the start of a
>> // unary-expression, but doesn't include any postfix pieces.
>> Parse these
>> // now if present.
>> - Operand = ParsePostfixExpressionSuffix(Operand.result());
>> + Operand = ParsePostfixExpressionSuffix(move(Operand));
>> }
>>
>> // If we get here, the operand to the sizeof/alignof was an
>> expresion.
>> @@ -851,7 +850,7 @@
>> switch (T) {
>> default: assert(0 && "Not a builtin primary expression!");
>> case tok::kw___builtin_va_arg: {
>> - OwningExprResult Expr(Actions, ParseAssignmentExpression());
>> + OwningExprResult Expr(ParseAssignmentExpression());
>> if (Expr.isInvalid()) {
>> SkipUntil(tok::r_paren);
>> return ExprResult(true);
>> @@ -933,7 +932,7 @@
>> break;
>> }
>> case tok::kw___builtin_choose_expr: {
>> - OwningExprResult Cond(Actions, ParseAssignmentExpression());
>> + OwningExprResult Cond(ParseAssignmentExpression());
>> if (Cond.isInvalid()) {
>> SkipUntil(tok::r_paren);
>> return Cond.result();
>> @@ -941,7 +940,7 @@
>> if (ExpectAndConsume(tok::comma, diag::err_expected_comma,
>> "",tok::r_paren))
>> return ExprResult(true);
>>
>> - OwningExprResult Expr1(Actions, ParseAssignmentExpression());
>> + OwningExprResult Expr1(ParseAssignmentExpression());
>> if (Expr1.isInvalid()) {
>> SkipUntil(tok::r_paren);
>> return Expr1.result();
>> @@ -949,7 +948,7 @@
>> if (ExpectAndConsume(tok::comma, diag::err_expected_comma,
>> "",tok::r_paren))
>> return ExprResult(true);
>>
>> - OwningExprResult Expr2(Actions, ParseAssignmentExpression());
>> + OwningExprResult Expr2(ParseAssignmentExpression());
>> if (Expr2.isInvalid()) {
>> SkipUntil(tok::r_paren);
>> return Expr2.result();
>> @@ -970,7 +969,7 @@
>> // comma. If there is no comma, break and attempt to match r-
>> paren.
>> if (Tok.isNot(tok::r_paren)) {
>> while (1) {
>> - OwningExprResult ArgExpr(Actions,
>> ParseAssignmentExpression());
>> + OwningExprResult ArgExpr(ParseAssignmentExpression());
>> if (ArgExpr.isInvalid()) {
>> SkipUntil(tok::r_paren);
>> return ExprResult(true);
>> @@ -1008,11 +1007,11 @@
>> }
>> Res = Actions.ActOnTypesCompatibleExpr(StartLoc, Ty1, Ty2,
>> ConsumeParen());
>> break;
>> - }
>> -
>> + }
>> +
>> // These can be followed by postfix-expr pieces because they are
>> // primary-expressions.
>> - return ParsePostfixExpressionSuffix(Res.result());
>> + return ParsePostfixExpressionSuffix(move(Res)).result();
>> }
>>
>> /// ParseParenExpression - This parses the unit that starts with a
>> '(' token,
>> @@ -1130,7 +1129,7 @@
>> ///
>> bool Parser::ParseExpressionList(ExprListTy &Exprs, CommaLocsTy
>> &CommaLocs) {
>> while (1) {
>> - OwningExprResult Expr(Actions, ParseAssignmentExpression());
>> + OwningExprResult Expr(ParseAssignmentExpression());
>> if (Expr.isInvalid())
>> return true;
>>
>>
>> Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Dec 11 15:36:32 2008
>> @@ -310,7 +310,7 @@
>> return Actions.ActOnCXXThrow(ThrowLoc);
>>
>> default:
>> - OwningExprResult Expr(Actions, ParseAssignmentExpression());
>> + OwningExprResult Expr(ParseAssignmentExpression());
>> if (Expr.isInvalid()) return Expr.result();
>> return Actions.ActOnCXXThrow(ThrowLoc, Expr.release());
>> }
>> @@ -372,7 +372,7 @@
>> /// [GNU] type-specifier-seq declarator simple-asm-expr[opt]
>> attributes[opt]
>> /// '=' assignment-expression
>> ///
>> -Parser::ExprResult Parser::ParseCXXCondition() {
>> +Parser::OwningExprResult Parser::ParseCXXCondition() {
>> if (!isCXXConditionDeclaration())
>> return ParseExpression(); // expression
>>
>> @@ -391,7 +391,7 @@
>> OwningExprResult AsmLabel(ParseSimpleAsm());
>> if (AsmLabel.isInvalid()) {
>> SkipUntil(tok::semi);
>> - return true;
>> + return ExprError();
>> }
>> DeclaratorInfo.setAsmLabel(AsmLabel.release());
>> }
>> @@ -402,15 +402,15 @@
>>
>> // '=' assignment-expression
>> if (Tok.isNot(tok::equal))
>> - return Diag(Tok, diag::err_expected_equal_after_declarator);
>> + return ExprError(Diag(Tok,
>> diag::err_expected_equal_after_declarator));
>> SourceLocation EqualLoc = ConsumeToken();
>> - OwningExprResult AssignExpr(Actions, ParseAssignmentExpression());
>> + OwningExprResult AssignExpr(ParseAssignmentExpression());
>> if (AssignExpr.isInvalid())
>> - return true;
>> -
>> - return Actions.ActOnCXXConditionDeclarationExpr(CurScope,
>> StartLoc,
>> - DeclaratorInfo,
>> EqualLoc,
>> -
>> AssignExpr.release());
>> + return ExprError();
>> +
>> + return Owned(Actions.ActOnCXXConditionDeclarationExpr(CurScope,
>> StartLoc,
>> +
>> DeclaratorInfo,EqualLoc,
>> +
>> AssignExpr.release()));
>> }
>>
>> /// ParseCXXSimpleTypeSpecifier - [C++ 7.1.5.2] Simple type
>> specifiers.
>> @@ -776,8 +776,8 @@
>> bool first = true;
>> while (Tok.is(tok::l_square)) {
>> SourceLocation LLoc = ConsumeBracket();
>> - OwningExprResult Size(Actions, first ? ParseExpression()
>> - :
>> ParseConstantExpression());
>> + OwningExprResult Size(first ? ParseExpression()
>> + : ParseConstantExpression());
>> if (Size.isInvalid()) {
>> // Recover
>> SkipUntil(tok::r_square);
>> @@ -851,7 +851,7 @@
>> return true;
>> }
>>
>> - OwningExprResult Operand(Actions, ParseCastExpression(false));
>> + OwningExprResult Operand(ParseCastExpression(false));
>> if (Operand.isInvalid())
>> return Operand.result();
>>
>>
>> Modified: cfe/trunk/lib/Parse/ParseInit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseInit.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseInit.cpp Thu Dec 11 15:36:32 2008
>> @@ -143,7 +143,7 @@
>> // Note that we parse this as an assignment expression, not a
>> constant
>> // expression (allowing *=, =, etc) to handle the objc case.
>> Sema needs
>> // to validate that the expression is a constant.
>> - OwningExprResult Idx(Actions, ParseAssignmentExpression());
>> + OwningExprResult Idx(ParseAssignmentExpression());
>> if (Idx.isInvalid()) {
>> SkipUntil(tok::r_square);
>> return Idx.result();
>> @@ -184,8 +184,8 @@
>> // Handle the gnu array range extension.
>> Diag(Tok, diag::ext_gnu_array_range);
>> ConsumeToken();
>> -
>> - OwningExprResult RHS(Actions, ParseConstantExpression());
>> +
>> + OwningExprResult RHS(ParseConstantExpression());
>> if (RHS.isInvalid()) {
>> SkipUntil(tok::r_square);
>> return RHS.result();
>>
>> Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Dec 11 15:36:32 2008
>> @@ -1199,7 +1199,7 @@
>> return StmtError();
>> }
>> ConsumeParen(); // '('
>> - OwningExprResult Res(Actions, ParseExpression());
>> + OwningExprResult Res(ParseExpression());
>> if (Res.isInvalid()) {
>> SkipUntil(tok::semi);
>> return StmtError();
>> @@ -1397,18 +1397,22 @@
>> switch (Tok.getKind()) {
>> case tok::string_literal: // primary-expression: string-literal
>> case tok::wide_string_literal:
>> - return
>> ParsePostfixExpressionSuffix(ParseObjCStringLiteral(AtLoc));
>> + return ParsePostfixExpressionSuffix(
>> + Owned(ParseObjCStringLiteral(AtLoc))).result();
>> default:
>> if (Tok.getIdentifierInfo() == 0)
>> return Diag(AtLoc, diag::err_unexpected_at);
>> -
>> +
>> switch (Tok.getIdentifierInfo()->getObjCKeywordID()) {
>> case tok::objc_encode:
>> - return
>> ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
>> + return ParsePostfixExpressionSuffix(
>> + Owned(ParseObjCEncodeExpression(AtLoc))).result();
>> case tok::objc_protocol:
>> - return
>> ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
>> + return ParsePostfixExpressionSuffix(
>> + Owned(ParseObjCProtocolExpression(AtLoc))).result();
>> case tok::objc_selector:
>> - return
>> ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
>> + return ParsePostfixExpressionSuffix(
>> + Owned(ParseObjCSelectorExpression(AtLoc))).result();
>> default:
>> return Diag(AtLoc, diag::err_unexpected_at);
>> }
>> @@ -1433,7 +1437,7 @@
>> return ParseObjCMessageExpressionBody(LBracLoc, NameLoc,
>> ReceiverName, 0);
>> }
>>
>> - OwningExprResult Res(Actions, ParseExpression());
>> + OwningExprResult Res(ParseExpression());
>> if (Res.isInvalid()) {
>> SkipUntil(tok::r_square);
>> return Res.result();
>> @@ -1492,7 +1496,7 @@
>>
>> ConsumeToken(); // Eat the ':'.
>> /// Parse the expression after ':'
>> - OwningExprResult Res(Actions, ParseAssignmentExpression());
>> + OwningExprResult Res(ParseAssignmentExpression());
>> if (Res.isInvalid()) {
>> // We must manually skip to a ']', otherwise the expression
>> skipper will
>> // stop at the ']' when it skips to the ';'. We want it to
>> skip beyond
>> @@ -1514,7 +1518,7 @@
>> while (Tok.is(tok::comma)) {
>> ConsumeToken(); // Eat the ','.
>> /// Parse the expression after ','
>> - OwningExprResult Res(Actions, ParseAssignmentExpression());
>> + OwningExprResult Res(ParseAssignmentExpression());
>> if (Res.isInvalid()) {
>> // We must manually skip to a ']', otherwise the expression
>> skipper will
>> // stop at the ']' when it skips to the ';'. We want it to
>> skip beyond
>>
>> Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=60900&r1=60899&r2=60900&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseStmt.cpp Thu Dec 11 15:36:32 2008
>> @@ -107,7 +107,7 @@
>> return StmtError();
>> } else {
>> // expression[opt] ';'
>> - OwningExprResult Expr(Actions, ParseExpression());
>> + OwningExprResult Expr(ParseExpression());
>> if (Expr.isInvalid()) {
>> // If the expression is invalid, skip ahead to the next
>> semicolon. Not
>> // doing this opens us up to the possibility of infinite
>> loops if
>> @@ -226,7 +226,7 @@
>> assert(Tok.is(tok::kw_case) && "Not a case stmt!");
>> SourceLocation CaseLoc = ConsumeToken(); // eat the 'case'.
>>
>> - OwningExprResult LHS(Actions, ParseConstantExpression());
>> + OwningExprResult LHS(ParseConstantExpression());
>> if (LHS.isInvalid()) {
>> SkipUntil(tok::colon);
>> return StmtError();
>> @@ -379,7 +379,7 @@
>> } else {
>> // Otherwise this was a unary __extension__ marker. Parse the
>> // subexpression and add the __extension__ unary op.
>> - OwningExprResult Res(Actions, ParseCastExpression(false));
>> + OwningExprResult Res(ParseCastExpression(false));
>>
>> if (Res.isInvalid()) {
>> SkipUntil(tok::semi);
>> @@ -940,7 +940,7 @@
>> // GNU indirect goto extension.
>> Diag(Tok, diag::ext_gnu_indirect_goto);
>> SourceLocation StarLoc = ConsumeToken();
>> - OwningExprResult R(Actions, ParseExpression());
>> + OwningExprResult R(ParseExpression());
>> if (R.isInvalid()) { // Skip to the semicolon, but don't
>> consume it.
>> SkipUntil(tok::semi, false, true);
>> return StmtError();
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list