Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111863 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index eeccfac..06eea9c 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -147,7 +147,7 @@
else
Diag(Tok.getLocation(), diag::err_default_arg_unparsed);
Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
- move(DefArgResult));
+ DefArgResult.take());
}
assert(!PP.getSourceManager().isBeforeInTranslationUnit(origLoc,
@@ -231,7 +231,7 @@
// Error recovery.
if (!Tok.is(tok::l_brace)) {
- Actions.ActOnFinishFunctionBody(LM.D, Action::StmtArg(Actions));
+ Actions.ActOnFinishFunctionBody(LM.D, 0);
continue;
}
} else
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8265f37..814f203 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -593,7 +593,7 @@
SkipUntil(tok::comma, true, true);
Actions.ActOnInitializerError(ThisDecl);
} else
- Actions.AddInitializerToDecl(ThisDecl, move(Init));
+ Actions.AddInitializerToDecl(ThisDecl, Init.take());
}
} else if (Tok.is(tok::l_paren)) {
// Parse C++ direct initializer: '(' expression-list ')'
@@ -3136,7 +3136,7 @@
} else {
// Inform the actions module about the default argument
Actions.ActOnParamDefaultArgument(Param, EqualLoc,
- move(DefArgResult));
+ DefArgResult.take());
}
}
}
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index ea42c72..c56a1b4 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -413,8 +413,9 @@
DeclEnd = Tok.getLocation();
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_static_assert);
- return Actions.ActOnStaticAssertDeclaration(StaticAssertLoc, move(AssertExpr),
- move(AssertMessage));
+ return Actions.ActOnStaticAssertDeclaration(StaticAssertLoc,
+ AssertExpr.take(),
+ AssertMessage.take());
}
/// ParseDecltypeSpecifier - Parse a C++0x decltype specifier.
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index f7b03f2..626a7ec 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -210,10 +210,10 @@
}
LHS = Actions.ActOnUnaryOp(getCurScope(), ExtLoc, tok::kw___extension__,
- move(LHS));
+ LHS.take());
if (LHS.isInvalid()) return move(LHS);
- return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
+ return ParseRHSOfBinaryExpression(LHS.take(), prec::Comma);
}
/// ParseAssignmentExpression - Parse an expr that doesn't include commas.
@@ -230,7 +230,7 @@
OwningExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
- return ParseRHSOfBinaryExpression(move(LHS), prec::Assignment);
+ return ParseRHSOfBinaryExpression(LHS.take(), prec::Assignment);
}
/// ParseAssignmentExprWithObjCMessageExprStart - Parse an assignment expression
@@ -245,14 +245,14 @@
Parser::ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracLoc,
SourceLocation SuperLoc,
TypeTy *ReceiverType,
- ExprArg ReceiverExpr) {
- OwningExprResult R(ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
- ReceiverType,
- move(ReceiverExpr)));
+ Expr *ReceiverExpr) {
+ OwningExprResult R
+ = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
+ ReceiverType, ReceiverExpr);
if (R.isInvalid()) return move(R);
- R = ParsePostfixExpressionSuffix(move(R));
+ R = ParsePostfixExpressionSuffix(R.take());
if (R.isInvalid()) return move(R);
- return ParseRHSOfBinaryExpression(move(R), prec::Assignment);
+ return ParseRHSOfBinaryExpression(R.take(), prec::Assignment);
}
@@ -266,7 +266,7 @@
OwningExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
- return ParseRHSOfBinaryExpression(move(LHS), prec::Conditional);
+ return ParseRHSOfBinaryExpression(LHS.take(), prec::Conditional);
}
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
@@ -384,7 +384,7 @@
// is okay, to bind exactly as tightly. For example, compile A=B=C=D as
// A=(B=(C=D)), where each paren is a level of recursion here.
// The function takes ownership of the RHS.
- RHS = ParseRHSOfBinaryExpression(move(RHS),
+ RHS = ParseRHSOfBinaryExpression(RHS.get(),
static_cast<prec::Level>(ThisPrec + !isRightAssoc));
if (RHS.isInvalid())
return move(RHS);
@@ -407,11 +407,11 @@
Actions.getExprRange(RHS.get()).getEnd()));
LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
- OpToken.getKind(), move(LHS), move(RHS));
+ OpToken.getKind(), LHS.take(), RHS.take());
} else
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
- move(LHS), move(TernaryMiddle),
- move(RHS));
+ LHS.take(), TernaryMiddle.take(),
+ RHS.take());
}
}
}
@@ -560,9 +560,10 @@
// expression, or statement expression.
//
// If the parsed tokens consist of a primary-expression, the cases below
- // call ParsePostfixExpressionSuffix to handle the postfix expression
- // suffixes. Cases that cannot be followed by postfix exprs should
- // return without invoking ParsePostfixExpressionSuffix.
+ // break out of the switch; at the end we call ParsePostfixExpressionSuffix
+ // to handle the postfix expression suffixes. Cases that cannot be followed
+ // by postfix exprs should return without invoking
+ // ParsePostfixExpressionSuffix.
switch (SavedKind) {
case tok::l_paren: {
// If this expression is limited to being a unary-expression, the parent can
@@ -596,8 +597,7 @@
return move(Res);
}
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
}
// primary-expression
@@ -607,9 +607,7 @@
Res = Actions.ActOnNumericConstant(Tok);
ConsumeToken();
-
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::kw_true:
case tok::kw_false:
@@ -660,8 +658,7 @@
Res = Actions.ActOnClassPropertyRefExpr(II, PropertyName,
ILoc, PropertyLoc);
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
}
// Function designators are allowed to be undeclared (C99 6.5.1p2), so we
@@ -672,28 +669,22 @@
Name.setIdentifier(&II, ILoc);
Res = Actions.ActOnIdExpression(getCurScope(), ScopeSpec, Name,
Tok.is(tok::l_paren), false);
-
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
}
case tok::char_constant: // constant: character-constant
Res = Actions.ActOnCharacterConstant(Tok);
ConsumeToken();
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
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(move(Res));
+ break;
case tok::string_literal: // primary-expression: string-literal
case tok::wide_string_literal:
Res = ParseStringLiteralExpression();
- if (Res.isInvalid()) return move(Res);
- // This can be followed by postfix-expr pieces (e.g. "foo"[1]).
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::kw___builtin_va_arg:
case tok::kw___builtin_offsetof:
case tok::kw___builtin_choose_expr:
@@ -711,7 +702,7 @@
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(!getLang().CPlusPlus);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
+ Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get());
return move(Res);
}
case tok::amp: { // unary-expression: '&' cast-expression
@@ -719,7 +710,7 @@
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(false, true);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
+ Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get());
return move(Res);
}
@@ -733,7 +724,7 @@
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(false);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
+ Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get());
return move(Res);
}
@@ -743,7 +734,7 @@
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(false);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
+ Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get());
return move(Res);
}
case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
@@ -769,16 +760,13 @@
case tok::kw_reinterpret_cast:
case tok::kw_static_cast:
Res = ParseCXXCasts();
- // These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::kw_typeid:
Res = ParseCXXTypeid();
- // This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::kw_this:
Res = ParseCXXThis();
- // This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::kw_char:
case tok::kw_wchar_t:
@@ -817,8 +805,7 @@
<< DS.getSourceRange());
Res = ParseCXXTypeConstructExpression(DS);
- // This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
}
case tok::annot_cxxscope: { // [C++] id-expression: qualified-id
@@ -848,7 +835,7 @@
// Parse as an id-expression.
Res = ParseCXXIdExpression(isAddressOfOperand);
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
}
case tok::annot_template_id: { // [C++] template-id
@@ -868,7 +855,7 @@
case tok::kw_operator: // [C++] id-expression: operator/conversion-function-id
Res = ParseCXXIdExpression(isAddressOfOperand);
- return ParsePostfixExpressionSuffix(move(Res));
+ break;
case tok::coloncolon: {
// ::foo::bar -> global qualified name etc. If TryAnnotateTypeOrScopeToken
@@ -932,8 +919,9 @@
return ExprError();
}
- // unreachable.
- abort();
+ // These can be followed by postfix-expr pieces.
+ if (Res.isInvalid()) return move(Res);
+ return ParsePostfixExpressionSuffix(Res.get());
}
/// ParsePostfixExpressionSuffix - Once the leading part of a postfix-expression
@@ -980,8 +968,8 @@
SourceLocation RLoc = Tok.getLocation();
if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
- LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), move(LHS), Loc,
- move(Idx), RLoc);
+ LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), LHS.take(), Loc,
+ Idx.take(), RLoc);
} else
LHS = ExprError();
@@ -1023,7 +1011,7 @@
if (!LHS.isInvalid()) {
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
- LHS = Actions.ActOnCallExpr(getCurScope(), move(LHS), Loc,
+ LHS = Actions.ActOnCallExpr(getCurScope(), LHS.take(), Loc,
move_arg(ArgExprs), CommaLocs.data(),
Tok.getLocation());
}
@@ -1042,7 +1030,7 @@
Action::TypeTy *ObjectType = 0;
bool MayBePseudoDestructor = false;
if (getLang().CPlusPlus && !LHS.isInvalid()) {
- LHS = Actions.ActOnStartCXXMemberReference(getCurScope(), move(LHS),
+ LHS = Actions.ActOnStartCXXMemberReference(getCurScope(), LHS.take(),
OpLoc, OpKind, ObjectType,
MayBePseudoDestructor);
if (LHS.isInvalid())
@@ -1062,8 +1050,8 @@
ConsumeCodeCompletionToken();
}
- if (MayBePseudoDestructor) {
- LHS = ParseCXXPseudoDestructor(move(LHS), OpLoc, OpKind, SS,
+ if (MayBePseudoDestructor && !LHS.isInvalid()) {
+ LHS = ParseCXXPseudoDestructor(LHS.take(), OpLoc, OpKind, SS,
ObjectType);
break;
}
@@ -1083,7 +1071,7 @@
return ExprError();
if (!LHS.isInvalid())
- LHS = Actions.ActOnMemberAccessExpr(getCurScope(), move(LHS), OpLoc,
+ LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.take(), OpLoc,
OpKind, SS, Name, ObjCImpDecl,
Tok.is(tok::l_paren));
break;
@@ -1092,7 +1080,7 @@
case tok::minusminus: // postfix-expression: postfix-expression '--'
if (!LHS.isInvalid()) {
LHS = Actions.ActOnPostfixUnaryOp(getCurScope(), Tok.getLocation(),
- Tok.getKind(), move(LHS));
+ Tok.getKind(), LHS.take());
}
ConsumeToken();
break;
@@ -1179,7 +1167,7 @@
// sizeof/alignof or in C++. Therefore, the parenthesized expression is
// the start of a unary-expression, but doesn't include any postfix
// pieces. Parse these now if present.
- Operand = ParsePostfixExpressionSuffix(move(Operand));
+ Operand = ParsePostfixExpressionSuffix(Operand.take());
}
}
@@ -1276,7 +1264,7 @@
if (Ty.isInvalid())
Res = ExprError();
else
- Res = Actions.ActOnVAArg(StartLoc, move(Expr), Ty.get(), ConsumeParen());
+ Res = Actions.ActOnVAArg(StartLoc, Expr.take(), Ty.get(), ConsumeParen());
break;
}
case tok::kw___builtin_offsetof: {
@@ -1377,8 +1365,8 @@
Diag(Tok, diag::err_expected_rparen);
return ExprError();
}
- Res = Actions.ActOnChooseExpr(StartLoc, move(Cond), move(Expr1),
- move(Expr2), ConsumeParen());
+ Res = Actions.ActOnChooseExpr(StartLoc, Cond.take(), Expr1.take(),
+ Expr2.take(), ConsumeParen());
break;
}
case tok::kw___builtin_types_compatible_p:
@@ -1402,9 +1390,12 @@
break;
}
+ if (Res.isInvalid())
+ return ExprError();
+
// These can be followed by postfix-expr pieces because they are
// primary-expressions.
- return ParsePostfixExpressionSuffix(move(Res));
+ return ParsePostfixExpressionSuffix(Res.take());
}
/// ParseParenExpression - This parses the unit that starts with a '(' token,
@@ -1439,7 +1430,7 @@
// If the substmt parsed correctly, build the AST node.
if (!Stmt.isInvalid() && Tok.is(tok::r_paren))
- Result = Actions.ActOnStmtExpr(OpenLoc, move(Stmt), Tok.getLocation());
+ Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.take(), Tok.getLocation());
} else if (ExprType >= CompoundLiteral &&
isTypeIdInParens(isAmbiguousTypeId)) {
@@ -1496,7 +1487,7 @@
Result = ParseCastExpression(false, false, CastTy);
if (!Result.isInvalid())
Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc, CastTy, RParenLoc,
- move(Result));
+ Result.take());
return move(Result);
}
@@ -1516,7 +1507,7 @@
Result = ParseExpression();
ExprType = SimpleExpr;
if (!Result.isInvalid() && Tok.is(tok::r_paren))
- Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), move(Result));
+ Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.take());
}
// Match the ')'.
@@ -1549,7 +1540,7 @@
Diag(LParenLoc, diag::ext_c99_compound_literal);
OwningExprResult Result = ParseInitializer();
if (!Result.isInvalid() && Ty)
- return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, move(Result));
+ return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.take());
return move(Result);
}
@@ -1734,7 +1725,7 @@
OwningStmtResult Stmt(ParseCompoundStatementBody());
if (!Stmt.isInvalid())
- Result = Actions.ActOnBlockStmtExpr(CaretLoc, move(Stmt), getCurScope());
+ Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope());
else
Actions.ActOnBlockError(CaretLoc, getCurScope());
return move(Result);
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index ea83547..82c5970 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -484,7 +484,7 @@
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
LAngleBracketLoc, CastTy.get(),
RAngleBracketLoc,
- LParenLoc, move(Result), RParenLoc);
+ LParenLoc, Result.take(), RParenLoc);
return move(Result);
}
@@ -613,7 +613,8 @@
/*TemplateKWLoc*/SourceLocation()))
return ExprError();
- return Actions.ActOnPseudoDestructorExpr(getCurScope(), move(Base), OpLoc, OpKind,
+ return Actions.ActOnPseudoDestructorExpr(getCurScope(), Base,
+ OpLoc, OpKind,
SS, FirstTypeName, CCLoc,
TildeLoc, SecondTypeName,
Tok.is(tok::l_paren));
@@ -647,12 +648,12 @@
case tok::r_brace:
case tok::colon:
case tok::comma:
- return Actions.ActOnCXXThrow(ThrowLoc, ExprArg(Actions));
+ return Actions.ActOnCXXThrow(ThrowLoc, 0);
default:
OwningExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return move(Expr);
- return Actions.ActOnCXXThrow(ThrowLoc, move(Expr));
+ return Actions.ActOnCXXThrow(ThrowLoc, Expr.take());
}
}
@@ -748,7 +749,7 @@
// If required, convert to a boolean value.
if (ConvertToBoolean)
ExprResult
- = Actions.ActOnBooleanCondition(getCurScope(), Loc, move(ExprResult));
+ = Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprResult.take());
return ExprResult.isInvalid();
}
@@ -790,7 +791,7 @@
SourceLocation EqualLoc = ConsumeToken();
OwningExprResult AssignExpr(ParseAssignmentExpression());
if (!AssignExpr.isInvalid())
- Actions.AddInitializerToDecl(DeclResult, move(AssignExpr));
+ Actions.AddInitializerToDecl(DeclResult, AssignExpr.take());
} else {
// FIXME: C++0x allows a braced-init-list
Diag(Tok, diag::err_expected_equal_after_declarator);
@@ -1745,7 +1746,7 @@
if (Operand.isInvalid())
return move(Operand);
- return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, move(Operand));
+ return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, Operand.take());
}
static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
@@ -1899,7 +1900,7 @@
// Result is what ParseCastExpression returned earlier.
if (!Result.isInvalid())
Result = Actions.ActOnCastExpr(getCurScope(), LParenLoc, CastTy, RParenLoc,
- move(Result));
+ Result.take());
return move(Result);
}
@@ -1909,7 +1910,7 @@
ExprType = SimpleExpr;
Result = ParseExpression();
if (!Result.isInvalid() && Tok.is(tok::r_paren))
- Result = Actions.ActOnParenExpr(LParenLoc, Tok.getLocation(), move(Result));
+ Result = Actions.ActOnParenExpr(LParenLoc, Tok.getLocation(), Result.take());
// Match the ')'.
if (Result.isInvalid()) {
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 52b6e3c..3be43d8 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -150,7 +150,7 @@
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
ConsumeToken(), 0,
- ExprArg(Actions));
+ 0);
}
// Parse the receiver, which is either a type or an expression.
@@ -168,7 +168,7 @@
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
TypeOrExpr,
- ExprArg(Actions));
+ 0);
}
// If the receiver was an expression, we still don't know
@@ -195,7 +195,7 @@
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
ConsumeToken(),
0,
- ExprArg(Actions));
+ 0);
ConsumeToken(); // the identifier
if (!ReceiverType) {
SkipUntil(tok::r_square);
@@ -205,7 +205,7 @@
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
ReceiverType,
- ExprArg(Actions));
+ 0);
case Action::ObjCInstanceMessage:
// Fall through; we'll just parse the expression and
@@ -239,7 +239,7 @@
CheckArrayDesignatorSyntax(*this, Tok.getLocation(), Desig);
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
- 0, move(Idx));
+ 0, Idx.take());
}
// If this is a normal array designator, remember it.
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 822d96b..df47fdf 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1470,7 +1470,7 @@
}
// consume ';'
ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@throw");
- return Actions.ActOnObjCAtThrowStmt(atLoc, move(Res), getCurScope());
+ return Actions.ActOnObjCAtThrowStmt(atLoc, Res.take(), getCurScope());
}
/// objc-synchronized-statement:
@@ -1507,7 +1507,7 @@
BodyScope.Exit();
if (SynchBody.isInvalid())
SynchBody = Actions.ActOnNullStmt(Tok.getLocation());
- return Actions.ActOnObjCAtSynchronizedStmt(atLoc, move(Res), move(SynchBody));
+ return Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.take(), SynchBody.take());
}
/// objc-try-catch-statement:
@@ -1586,7 +1586,7 @@
OwningStmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc,
FirstPart,
- move(CatchBody));
+ CatchBody.take());
if (!Catch.isInvalid())
CatchStmts.push_back(Catch.release());
@@ -1609,7 +1609,7 @@
if (FinallyBody.isInvalid())
FinallyBody = Actions.ActOnNullStmt(Tok.getLocation());
FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc,
- move(FinallyBody));
+ FinallyBody.take());
catch_or_finally_seen = true;
break;
}
@@ -1619,9 +1619,9 @@
return StmtError();
}
- return Actions.ActOnObjCAtTryStmt(atLoc, move(TryBody),
+ return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.take(),
move_arg(CatchStmts),
- move(FinallyStmt));
+ FinallyStmt.take());
}
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
@@ -1671,7 +1671,7 @@
MultiStmtArg(Actions), false);
// TODO: Pass argument information.
- Actions.ActOnFinishFunctionBody(MDecl, move(FnBody));
+ Actions.ActOnFinishFunctionBody(MDecl, FnBody.take());
// Leave the function body scope.
BodyScope.Exit();
@@ -1706,7 +1706,7 @@
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(Actions.MakeFullExpr(Res));
+ return Actions.ActOnExprStmt(Actions.MakeFullExpr(Res.take()));
}
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
@@ -1797,9 +1797,9 @@
// instance method.
OwningExprResult Receiver = ParseCXXTypeConstructExpression(DS);
if (!Receiver.isInvalid())
- Receiver = ParsePostfixExpressionSuffix(move(Receiver));
+ Receiver = ParsePostfixExpressionSuffix(Receiver.take());
if (!Receiver.isInvalid())
- Receiver = ParseRHSOfBinaryExpression(move(Receiver), prec::Comma);
+ Receiver = ParseRHSOfBinaryExpression(Receiver.take(), prec::Comma);
if (Receiver.isInvalid())
return true;
@@ -1863,7 +1863,7 @@
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope())
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0,
- ExprArg(Actions));
+ 0);
// Parse the receiver, which is either a type or an expression.
bool IsExpr;
@@ -1875,10 +1875,10 @@
if (IsExpr)
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), 0,
- OwningExprResult(static_cast<Expr*>(TypeOrExpr)));
+ static_cast<Expr*>(TypeOrExpr));
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
- TypeOrExpr, ExprArg(Actions));
+ TypeOrExpr, 0);
}
if (Tok.is(tok::identifier)) {
@@ -1890,8 +1890,7 @@
NextToken().is(tok::period),
ReceiverType)) {
case Action::ObjCSuperMessage:
- return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0,
- ExprArg(Actions));
+ return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0, 0);
case Action::ObjCClassMessage:
if (!ReceiverType) {
@@ -1902,8 +1901,7 @@
ConsumeToken(); // the type name
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
- ReceiverType,
- ExprArg(Actions));
+ ReceiverType, 0);
case Action::ObjCInstanceMessage:
// Fall through to parse an expression.
@@ -1919,7 +1917,7 @@
}
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), 0,
- move(Res));
+ Res.take());
}
/// \brief Parse the remainder of an Objective-C message following the
@@ -1971,7 +1969,7 @@
else if (ReceiverType)
Actions.CodeCompleteObjCClassMessage(getCurScope(), ReceiverType, 0, 0);
else
- Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr.get(),
+ Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr,
0, 0);
ConsumeCodeCompletionToken();
}
@@ -2024,7 +2022,7 @@
KeyIdents.data(),
KeyIdents.size());
else
- Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr.get(),
+ Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr,
KeyIdents.data(),
KeyIdents.size());
ConsumeCodeCompletionToken();
@@ -2093,7 +2091,7 @@
Action::MultiExprArg(Actions,
KeyExprs.take(),
KeyExprs.size()));
- return Actions.ActOnInstanceMessage(getCurScope(), move(ReceiverExpr), Sel,
+ return Actions.ActOnInstanceMessage(getCurScope(), ReceiverExpr, Sel,
LBracLoc, SelectorLoc, RBracLoc,
Action::MultiExprArg(Actions,
KeyExprs.take(),
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index de81c77..fc672eb 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -137,7 +137,7 @@
}
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(Actions.MakeFullExpr(Expr));
+ return Actions.ActOnExprStmt(Actions.MakeFullExpr(Expr.get()));
}
case tok::kw_case: // C99 6.8.1: labeled-statement
@@ -243,7 +243,7 @@
// FIXME: use attributes?
return Actions.ActOnLabelStmt(IdentTok.getLocation(),
IdentTok.getIdentifierInfo(),
- ColonLoc, move(SubStmt));
+ ColonLoc, SubStmt.get());
}
/// ParseCaseStatement
@@ -324,8 +324,8 @@
SourceLocation ColonLoc = ConsumeToken();
OwningStmtResult Case =
- Actions.ActOnCaseStmt(CaseLoc, move(LHS), DotDotDotLoc,
- move(RHS), ColonLoc);
+ Actions.ActOnCaseStmt(CaseLoc, LHS.get(), DotDotDotLoc,
+ RHS.get(), ColonLoc);
// If we had a sema error parsing this case, then just ignore it and
// continue parsing the sub-stmt.
@@ -340,7 +340,7 @@
if (TopLevelCase.isInvalid())
TopLevelCase = move(Case);
else
- Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, move(Case));
+ Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, Case.get());
DeepestParsedCaseStmt = NextDeepest;
}
@@ -367,7 +367,7 @@
SubStmt = Actions.ActOnNullStmt(SourceLocation());
// Install the body into the most deeply-nested case.
- Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, move(SubStmt));
+ Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, SubStmt.get());
// Return the top level parsed statement tree.
return move(TopLevelCase);
@@ -404,7 +404,7 @@
return StmtError();
return Actions.ActOnDefaultStmt(DefaultLoc, ColonLoc,
- move(SubStmt), getCurScope());
+ SubStmt.get(), getCurScope());
}
@@ -507,7 +507,7 @@
// Eat the semicolon at the end of stmt and convert the expr into a
// statement.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- R = Actions.ActOnExprStmt(Actions.MakeFullExpr(Res));
+ R = Actions.ActOnExprStmt(Actions.MakeFullExpr(Res.get()));
}
}
@@ -554,7 +554,7 @@
// If required, convert to a boolean value.
if (!ExprResult.isInvalid() && ConvertToBoolean)
ExprResult
- = Actions.ActOnBooleanCondition(getCurScope(), Loc, move(ExprResult));
+ = Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprResult.get());
}
// If the parser was confused by the condition and we don't have a ')', try to
@@ -616,7 +616,7 @@
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
return StmtError();
- FullExprArg FullCondExp(Actions.MakeFullExpr(CondExp));
+ FullExprArg FullCondExp(Actions.MakeFullExpr(CondExp.get()));
// C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
@@ -696,8 +696,8 @@
if (ElseStmt.isInvalid())
ElseStmt = Actions.ActOnNullStmt(ElseStmtLoc);
- return Actions.ActOnIfStmt(IfLoc, FullCondExp, CondVar, move(ThenStmt),
- ElseLoc, move(ElseStmt));
+ return Actions.ActOnIfStmt(IfLoc, FullCondExp, CondVar, ThenStmt.get(),
+ ElseLoc, ElseStmt.get());
}
/// ParseSwitchStatement
@@ -743,7 +743,7 @@
return StmtError();
OwningStmtResult Switch
- = Actions.ActOnStartOfSwitchStmt(SwitchLoc, move(Cond), CondVar);
+ = Actions.ActOnStartOfSwitchStmt(SwitchLoc, Cond.get(), CondVar);
if (Switch.isInvalid()) {
// Skip the switch body.
@@ -783,7 +783,7 @@
// FIXME: Remove the case statement list from the Switch statement.
Body = Actions.ActOnNullStmt(Tok.getLocation());
- return Actions.ActOnFinishSwitchStmt(SwitchLoc, move(Switch), move(Body));
+ return Actions.ActOnFinishSwitchStmt(SwitchLoc, Switch.get(), Body.get());
}
/// ParseWhileStatement
@@ -832,7 +832,7 @@
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
- FullExprArg FullCond(Actions.MakeFullExpr(Cond));
+ FullExprArg FullCond(Actions.MakeFullExpr(Cond.get()));
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
// there is no compound stmt. C90 does not have this clause. We only do this
@@ -858,7 +858,7 @@
if ((Cond.isInvalid() && !CondVar) || Body.isInvalid())
return StmtError();
- return Actions.ActOnWhileStmt(WhileLoc, FullCond, CondVar, move(Body));
+ return Actions.ActOnWhileStmt(WhileLoc, FullCond, CondVar, Body.get());
}
/// ParseDoStatement
@@ -925,8 +925,8 @@
if (Cond.isInvalid() || Body.isInvalid())
return StmtError();
- return Actions.ActOnDoStmt(DoLoc, move(Body), WhileLoc, LPLoc,
- move(Cond), RPLoc);
+ return Actions.ActOnDoStmt(DoLoc, Body.get(), WhileLoc, LPLoc,
+ Cond.get(), RPLoc);
}
/// ParseForStatement
@@ -1038,7 +1038,7 @@
// Turn the expression into a stmt.
if (!Value.isInvalid())
- FirstPart = Actions.ActOnExprStmt(Actions.MakeFullExpr(Value));
+ FirstPart = Actions.ActOnExprStmt(Actions.MakeFullExpr(Value.get()));
if (Tok.is(tok::semi)) {
ConsumeToken();
@@ -1056,7 +1056,7 @@
}
}
if (!ForEach) {
- assert(!SecondPart->get() && "Shouldn't have a second expression yet.");
+ assert(!SecondPart.get() && "Shouldn't have a second expression yet.");
// Parse the second part of the for specifier.
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
@@ -1068,10 +1068,10 @@
Second = ParseExpression();
if (!Second.isInvalid())
Second = Actions.ActOnBooleanCondition(getCurScope(), ForLoc,
- move(Second));
+ Second.get());
}
SecondPartIsInvalid = Second.isInvalid();
- SecondPart = Actions.MakeFullExpr(Second);
+ SecondPart = Actions.MakeFullExpr(Second.get());
}
if (Tok.is(tok::semi)) {
@@ -1085,7 +1085,7 @@
// Parse the third part of the for specifier.
if (Tok.isNot(tok::r_paren)) { // for (...;...;)
OwningExprResult Third = ParseExpression();
- ThirdPart = Actions.MakeFullExpr(Third);
+ ThirdPart = Actions.MakeFullExpr(Third.take());
}
}
// Match the ')'.
@@ -1118,14 +1118,14 @@
return StmtError();
if (!ForEach)
- return Actions.ActOnForStmt(ForLoc, LParenLoc, move(FirstPart), SecondPart,
- SecondVar, ThirdPart, RParenLoc, move(Body));
+ return Actions.ActOnForStmt(ForLoc, LParenLoc, FirstPart.take(), SecondPart,
+ SecondVar, ThirdPart, RParenLoc, Body.take());
// FIXME: It isn't clear how to communicate the late destruction of
// C++ temporaries used to create the collection.
- return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc, move(FirstPart),
- move(Collection), RParenLoc,
- move(Body));
+ return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc, FirstPart.take(),
+ Collection.take(), RParenLoc,
+ Body.take());
}
/// ParseGotoStatement
@@ -1156,7 +1156,7 @@
SkipUntil(tok::semi, false, true);
return StmtError();
}
- Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, move(R));
+ Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, R.take());
} else {
Diag(Tok, diag::err_expected_ident);
return StmtError();
@@ -1218,7 +1218,7 @@
return StmtError();
}
}
- return Actions.ActOnReturnStmt(ReturnLoc, move(R));
+ return Actions.ActOnReturnStmt(ReturnLoc, R.take());
}
/// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
@@ -1253,7 +1253,7 @@
ExprVector Clobbers(Actions);
return Actions.ActOnAsmStmt(Tok.getLocation(), true, true, 0, 0, 0,
move_arg(Constraints), move_arg(Exprs),
- move(AsmString), move_arg(Clobbers),
+ AsmString.take(), move_arg(Clobbers),
Tok.getLocation(), true);
}
@@ -1326,7 +1326,7 @@
return Actions.ActOnAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile,
/*NumOutputs*/ 0, /*NumInputs*/ 0, 0,
move_arg(Constraints), move_arg(Exprs),
- move(AsmString), move_arg(Clobbers),
+ AsmString.take(), move_arg(Clobbers),
RParenLoc);
}
@@ -1391,7 +1391,7 @@
return Actions.ActOnAsmStmt(AsmLoc, false, isVolatile,
NumOutputs, NumInputs, Names.data(),
move_arg(Constraints), move_arg(Exprs),
- move(AsmString), move_arg(Clobbers),
+ AsmString.take(), move_arg(Clobbers),
RParenLoc);
}
@@ -1482,7 +1482,7 @@
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc,
MultiStmtArg(Actions), false);
- return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));
+ return Actions.ActOnFinishFunctionBody(Decl, FnBody.take());
}
/// ParseFunctionTryBlock - Parse a C++ function-try-block.
@@ -1510,7 +1510,7 @@
FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc,
MultiStmtArg(Actions), false);
- return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));
+ return Actions.ActOnFinishFunctionBody(Decl, FnBody.take());
}
/// ParseCXXTryBlock - Parse a C++ try-block.
@@ -1566,7 +1566,7 @@
if (Handlers.empty())
return StmtError();
- return Actions.ActOnCXXTryBlock(TryLoc, move(TryBlock), move_arg(Handlers));
+ return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(), move_arg(Handlers));
}
/// ParseCXXCatchBlock - Parse a C++ catch block, called handler in the standard
@@ -1618,5 +1618,5 @@
if (Block.isInvalid())
return move(Block);
- return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, move(Block));
+ return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, Block.take());
}
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 795fea7..835b6e5 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -620,7 +620,7 @@
// Create the parameter.
return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl,
Depth, Position, EqualLoc,
- move(DefaultArg));
+ DefaultArg.take());
}
/// \brief Parses a template-id that after the template name has
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index fab6848..498a7d3 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -443,7 +443,7 @@
if (Result.isInvalid())
return DeclGroupPtrTy();
- SingleDecl = Actions.ActOnFileScopeAsmDecl(Tok.getLocation(), move(Result));
+ SingleDecl = Actions.ActOnFileScopeAsmDecl(Tok.getLocation(), Result.get());
break;
}
case tok::at:
@@ -696,7 +696,7 @@
// Recover from error.
if (!Tok.is(tok::l_brace)) {
- Actions.ActOnFinishFunctionBody(Res, Action::StmtArg(Actions));
+ Actions.ActOnFinishFunctionBody(Res, 0);
return Res;
}
} else