aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-10 00:02:53 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-10 00:02:53 +0000
commiteffa8d1c97b00a3f53e972b0e61d9aade5ea1c57 (patch)
tree841987d02feb0d8e50485212e3580660c5c1847e /lib/Parse
parent1d6c14bd27ee4945aa453ab2e8d2b3dfca374318 (diff)
Modify the move emulation according to the excellent design of Howard Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse')
-rw-r--r--lib/Parse/ParseDecl.cpp22
-rw-r--r--lib/Parse/ParseDeclCXX.cpp4
-rw-r--r--lib/Parse/ParseExpr.cpp146
-rw-r--r--lib/Parse/ParseExprCXX.cpp27
-rw-r--r--lib/Parse/ParseInit.cpp13
-rw-r--r--lib/Parse/ParseObjc.cpp40
-rw-r--r--lib/Parse/ParsePragma.cpp2
-rw-r--r--lib/Parse/ParseStmt.cpp96
-rw-r--r--lib/Parse/Parser.cpp20
9 files changed, 189 insertions, 181 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 242c1b3c6f..e7f4fc92ea 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -132,7 +132,7 @@ AttributeList *Parser::ParseAttributes() {
SkipUntil(tok::r_paren);
break;
} else {
- ArgExprs.push_back(ArgExpr.move());
+ ArgExprs.push_back(ArgExpr.release());
}
if (Tok.isNot(tok::comma))
break;
@@ -164,7 +164,7 @@ AttributeList *Parser::ParseAttributes() {
SkipUntil(tok::r_paren);
break;
} else {
- ArgExprs.push_back(ArgExpr.move());
+ ArgExprs.push_back(ArgExpr.release());
}
if (Tok.isNot(tok::comma))
break;
@@ -270,13 +270,13 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
while (1) {
// If a simple-asm-expr is present, parse it.
if (Tok.is(tok::kw_asm)) {
- OwningExprResult AsmLabel(Actions, ParseSimpleAsm());
+ OwningExprResult AsmLabel(ParseSimpleAsm());
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi);
return 0;
}
- D.setAsmLabel(AsmLabel.move());
+ D.setAsmLabel(AsmLabel.release());
}
// If attributes are present, parse them.
@@ -294,7 +294,7 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
SkipUntil(tok::semi);
return 0;
}
- Actions.AddInitializerToDecl(LastDeclInGroup, Init.move());
+ Actions.AddInitializerToDecl(LastDeclInGroup, Init.release());
} else if (Tok.is(tok::l_paren)) {
// Parse C++ direct initializer: '(' expression-list ')'
SourceLocation LParenLoc = ConsumeParen();
@@ -846,7 +846,7 @@ ParseStructDeclaration(DeclSpec &DS,
if (Res.isInvalid())
SkipUntil(tok::semi, true, true);
else
- DeclaratorInfo.BitfieldSize = Res.move();
+ DeclaratorInfo.BitfieldSize = Res.release();
}
// If attributes exist after the declarator, parse them.
@@ -1087,7 +1087,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclTy *EnumDecl) {
LastEnumConstDecl,
IdentLoc, Ident,
EqualLoc,
- AssignedVal.move());
+ AssignedVal.release());
EnumConstantDecls.push_back(EnumConstDecl);
LastEnumConstDecl = EnumConstDecl;
@@ -1802,7 +1802,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
} else {
// Inform the actions module about the default argument
Actions.ActOnParamDefaultArgument(Param, EqualLoc,
- DefArgResult.move());
+ DefArgResult.release());
}
}
@@ -1973,7 +1973,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) {
// Remember that we parsed a pointer type, and remember the type-quals.
D.AddTypeInfo(DeclaratorChunk::getArray(DS.getTypeQualifiers(),
StaticLoc.isValid(), isStar,
- NumElements.move(), StartLoc));
+ NumElements.release(), StartLoc));
}
/// [GNU] typeof-specifier:
@@ -2000,7 +2000,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
const char *PrevSpec = 0;
// Check for duplicate type specifiers.
if (DS.SetTypeSpecType(DeclSpec::TST_typeofExpr, StartLoc, PrevSpec,
- Result.move()))
+ Result.release()))
Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec;
// FIXME: Not accurate, the range gets one token more than it should.
@@ -2035,7 +2035,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
const char *PrevSpec = 0;
// Check for duplicate type specifiers (e.g. "int typeof(int)").
if (DS.SetTypeSpecType(DeclSpec::TST_typeofExpr, StartLoc, PrevSpec,
- Result.move()))
+ Result.release()))
Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec;
}
DS.SetRangeEnd(RParenLoc);
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 4b92c91863..c3b94bc628 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -529,8 +529,8 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) {
// See Sema::ActOnCXXMemberDeclarator for details.
LastDeclInGroup = Actions.ActOnCXXMemberDeclarator(CurScope, AS,
DeclaratorInfo,
- BitfieldSize.move(),
- Init.move(),
+ BitfieldSize.release(),
+ Init.release(),
LastDeclInGroup);
// If we don't have a comma, it is either the end of the list (a ';')
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 9a8956c274..4cf7c1e4f7 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -174,9 +174,9 @@ Parser::ExprResult Parser::ParseExpression() {
return ParseThrowExpression();
OwningExprResult LHS(Actions, ParseCastExpression(false));
- if (LHS.isInvalid()) return LHS.move();
+ if (LHS.isInvalid()) return LHS.result();
- return ParseRHSOfBinaryExpression(LHS.move(), prec::Comma);
+ return ParseRHSOfBinaryExpression(LHS.result(), prec::Comma);
}
/// This routine is called when the '@' is seen and consumed.
@@ -186,9 +186,9 @@ Parser::ExprResult Parser::ParseExpression() {
///
Parser::ExprResult Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) {
OwningExprResult LHS(Actions, ParseObjCAtExpression(AtLoc));
- if (LHS.isInvalid()) return LHS.move();
+ if (LHS.isInvalid()) return LHS.result();
- return ParseRHSOfBinaryExpression(LHS.move(), prec::Comma);
+ return ParseRHSOfBinaryExpression(LHS.result(), prec::Comma);
}
/// ParseAssignmentExpression - Parse an expr that doesn't include commas.
@@ -198,9 +198,9 @@ Parser::ExprResult Parser::ParseAssignmentExpression() {
return ParseThrowExpression();
OwningExprResult LHS(Actions, ParseCastExpression(false));
- if (LHS.isInvalid()) return LHS.move();
+ if (LHS.isInvalid()) return LHS.result();
- return ParseRHSOfBinaryExpression(LHS.move(), prec::Assignment);
+ return ParseRHSOfBinaryExpression(LHS.result(), prec::Assignment);
}
/// ParseAssignmentExprWithObjCMessageExprStart - Parse an assignment expression
@@ -219,18 +219,18 @@ Parser::ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracLoc,
OwningExprResult R(Actions, ParseObjCMessageExpressionBody(LBracLoc, NameLoc,
ReceiverName,
ReceiverExpr));
- if (R.isInvalid()) return R.move();
- R = ParsePostfixExpressionSuffix(R.move());
- if (R.isInvalid()) return R.move();
- return ParseRHSOfBinaryExpression(R.move(), 2);
+ if (R.isInvalid()) return R.result();
+ R = ParsePostfixExpressionSuffix(R.result());
+ 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.move();
+ if (LHS.isInvalid()) return LHS.result();
- return ParseRHSOfBinaryExpression(LHS.move(), prec::Conditional);
+ return ParseRHSOfBinaryExpression(LHS.result(), prec::Conditional);
}
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
@@ -246,7 +246,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHSArg, unsigned MinPrec) {
// because we are called recursively, or because the token is not a binop),
// then we are done!
if (NextTokPrec < MinPrec)
- return LHS.move();
+ return LHS.result();
// Consume the operator, saving the operator token for error reporting.
Token OpToken = Tok;
@@ -262,7 +262,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHSArg, unsigned MinPrec) {
// 'logical-OR-expression' as we might expect.
TernaryMiddle = ParseExpression();
if (TernaryMiddle.isInvalid())
- return TernaryMiddle.move();
+ return TernaryMiddle.result();
} else {
// Special case handling of "X ? Y : Z" where Y is empty:
// logical-OR-expression '?' ':' conditional-expression [GNU]
@@ -283,7 +283,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHSArg, unsigned MinPrec) {
// Parse another leaf here for the RHS of the operator.
OwningExprResult RHS(Actions, ParseCastExpression(false));
if (RHS.isInvalid())
- return RHS.move();
+ return RHS.result();
// Remember the precedence of this operator and get the precedence of the
// operator immediately to the right of the RHS.
@@ -303,9 +303,9 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHSArg, unsigned MinPrec) {
// 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(RHS.move(), ThisPrec + !isRightAssoc);
+ RHS = ParseRHSOfBinaryExpression(RHS.result(), ThisPrec + !isRightAssoc);
if (RHS.isInvalid())
- return RHS.move();
+ return RHS.result();
NextTokPrec = getBinOpPrecedence(Tok.getKind());
}
@@ -314,12 +314,13 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHSArg, unsigned MinPrec) {
if (!LHS.isInvalid()) {
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (TernaryMiddle.isInvalid())
- LHS = Actions.ActOnBinOp(CurScope, OpToken.getLocation(),
- OpToken.getKind(), LHS.move(), RHS.move());
+ LHS = Actions.ActOnBinOp(CurScope, OpToken.getLocation(),
+ OpToken.getKind(), LHS.release(),
+ RHS.release());
else
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
- LHS.move(), TernaryMiddle.move(),
- RHS.move());
+ LHS.release(), TernaryMiddle.release(),
+ RHS.release());
}
}
}
@@ -443,7 +444,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
SourceLocation LParenLoc = Tok.getLocation();
SourceLocation RParenLoc;
Res = ParseParenExpression(ParenExprType, CastTy, RParenLoc);
- if (Res.isInvalid()) return Res.move();
+ if (Res.isInvalid()) return Res.result();
switch (ParenExprType) {
case SimpleExpr: break; // Nothing else to do.
@@ -458,12 +459,13 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
// TODO: For cast expression with CastTy.
Res = ParseCastExpression(false);
if (!Res.isInvalid())
- Res = Actions.ActOnCastExpr(LParenLoc, CastTy, RParenLoc, Res.move());
- return Res.move();
+ Res = Actions.ActOnCastExpr(LParenLoc, CastTy, RParenLoc,
+ Res.release());
+ return Res.result();
}
// These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
}
// primary-expression
@@ -475,7 +477,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
ConsumeToken();
// These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::kw_true:
case tok::kw_false:
@@ -493,26 +495,26 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
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.move());
+ return ParsePostfixExpressionSuffix(Res.result());
}
case tok::char_constant: // constant: character-constant
Res = Actions.ActOnCharacterConstant(Tok);
ConsumeToken();
// These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
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.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::string_literal: // primary-expression: string-literal
case tok::wide_string_literal:
Res = ParseStringLiteralExpression();
- if (Res.isInvalid()) return Res.move();
+ if (Res.isInvalid()) return Res.result();
// This can be followed by postfix-expr pieces (e.g. "foo"[1]).
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::kw___builtin_va_arg:
case tok::kw___builtin_offsetof:
case tok::kw___builtin_choose_expr:
@@ -527,8 +529,8 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(true);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.move());
- return Res.move();
+ Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.release());
+ return Res.result();
}
case tok::amp: // unary-expression: '&' cast-expression
case tok::star: // unary-expression: '*' cast-expression
@@ -541,8 +543,8 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(false);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.move());
- return Res.move();
+ Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.release());
+ return Res.result();
}
case tok::kw___extension__:{//unary-expression:'__extension__' cast-expr [GNU]
@@ -551,8 +553,8 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
SourceLocation SavedLoc = ConsumeToken();
Res = ParseCastExpression(false);
if (!Res.isInvalid())
- Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.move());
- return Res.move();
+ Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.release());
+ return Res.result();
}
case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
// unary-expression: 'sizeof' '(' type-name ')'
@@ -567,12 +569,12 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
Diag(Tok, diag::err_expected_ident);
return ExprResult(true);
}
-
+
Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(),
Tok.getIdentifierInfo());
ConsumeToken();
- return Res.move();
+ return Res.result();
}
case tok::kw_const_cast:
case tok::kw_dynamic_cast:
@@ -580,15 +582,15 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
case tok::kw_static_cast:
Res = ParseCXXCasts();
// These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::kw_typeid:
Res = ParseCXXTypeid();
// This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::kw_this:
Res = ParseCXXThis();
// This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::kw_char:
case tok::kw_wchar_t:
@@ -616,14 +618,14 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
Res = ParseCXXTypeConstructExpression(DS);
// This can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
}
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.move());
+ return ParsePostfixExpressionSuffix(Res.result());
case tok::coloncolon: // [C++] new-expression or [C++] delete-expression
// If the next token is neither 'new' nor 'delete', the :: would have been
@@ -689,7 +691,7 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHSArg) {
while (1) {
switch (Tok.getKind()) {
default: // Not a postfix-expression suffix.
- return LHS.move();
+ return LHS.result();
case tok::l_square: { // postfix-expression: p-e '[' expression ']'
Loc = ConsumeBracket();
OwningExprResult Idx(Actions, ParseExpression());
@@ -697,8 +699,8 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHSArg) {
SourceLocation RLoc = Tok.getLocation();
if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
- LHS = Actions.ActOnArraySubscriptExpr(CurScope, LHS.move(), Loc,
- Idx.move(), RLoc);
+ LHS = Actions.ActOnArraySubscriptExpr(CurScope, LHS.release(), Loc,
+ Idx.release(), RLoc);
} else
LHS = ExprResult(true);
@@ -724,7 +726,7 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHSArg) {
if (!LHS.isInvalid() && Tok.is(tok::r_paren)) {
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
- LHS = Actions.ActOnCallExpr(CurScope, LHS.move(), Loc,
+ LHS = Actions.ActOnCallExpr(CurScope, LHS.release(), Loc,
ArgExprs.take(),
ArgExprs.size(), &CommaLocs[0],
Tok.getLocation());
@@ -744,7 +746,7 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHSArg) {
}
if (!LHS.isInvalid()) {
- LHS = Actions.ActOnMemberReferenceExpr(LHS.move(), OpLoc, OpKind,
+ LHS = Actions.ActOnMemberReferenceExpr(LHS.release(), OpLoc, OpKind,
Tok.getLocation(),
*Tok.getIdentifierInfo());
}
@@ -755,7 +757,7 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHSArg) {
case tok::minusminus: // postfix-expression: postfix-expression '--'
if (!LHS.isInvalid()) {
LHS = Actions.ActOnPostfixUnaryOp(CurScope, Tok.getLocation(),
- Tok.getKind(), LHS.move());
+ Tok.getKind(), LHS.release());
}
ConsumeToken();
break;
@@ -803,16 +805,16 @@ Parser::ExprResult Parser::ParseSizeofAlignofExpression() {
// 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.move());
+ Operand = ParsePostfixExpressionSuffix(Operand.result());
}
// If we get here, the operand to the sizeof/alignof was an expresion.
if (!Operand.isInvalid())
Operand = Actions.ActOnSizeOfAlignOfExpr(OpTok.getLocation(),
OpTok.is(tok::kw_sizeof),
- /*isType=*/false, Operand.move(),
- SourceRange());
- return Operand.move();
+ /*isType=*/false,
+ Operand.release(), SourceRange());
+ return Operand.result();
}
/// ParseBuiltinPrimaryExpression
@@ -864,7 +866,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
Diag(Tok, diag::err_expected_rparen);
return ExprResult(true);
}
- Res = Actions.ActOnVAArg(StartLoc, Expr.move(), Ty, ConsumeParen());
+ Res = Actions.ActOnVAArg(StartLoc, Expr.release(), Ty, ConsumeParen());
break;
}
case tok::kw___builtin_offsetof: {
@@ -913,9 +915,9 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
Res = ParseExpression();
if (Res.isInvalid()) {
SkipUntil(tok::r_paren);
- return Res.move();
+ return Res.result();
}
- Comps.back().U.E = Res.move();
+ Comps.back().U.E = Res.release();
Comps.back().LocEnd =
MatchRHSPunctuation(tok::r_square, Comps.back().LocStart);
@@ -934,7 +936,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
OwningExprResult Cond(Actions, ParseAssignmentExpression());
if (Cond.isInvalid()) {
SkipUntil(tok::r_paren);
- return Cond.move();
+ return Cond.result();
}
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprResult(true);
@@ -942,7 +944,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
OwningExprResult Expr1(Actions, ParseAssignmentExpression());
if (Expr1.isInvalid()) {
SkipUntil(tok::r_paren);
- return Expr1.move();
+ return Expr1.result();
}
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprResult(true);
@@ -950,14 +952,14 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
OwningExprResult Expr2(Actions, ParseAssignmentExpression());
if (Expr2.isInvalid()) {
SkipUntil(tok::r_paren);
- return Expr2.move();
+ return Expr2.result();
}
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected_rparen);
return ExprResult(true);
}
- Res = Actions.ActOnChooseExpr(StartLoc, Cond.move(), Expr1.move(),
- Expr2.move(), ConsumeParen());
+ Res = Actions.ActOnChooseExpr(StartLoc, Cond.release(), Expr1.release(),
+ Expr2.release(), ConsumeParen());
break;
}
case tok::kw___builtin_overload: {
@@ -973,7 +975,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
SkipUntil(tok::r_paren);
return ExprResult(true);
} else
- ArgExprs.push_back(ArgExpr.move());
+ ArgExprs.push_back(ArgExpr.release());
if (Tok.isNot(tok::comma))
break;
@@ -1010,7 +1012,7 @@ Parser::ExprResult Parser::ParseBuiltinPrimaryExpression() {
// These can be followed by postfix-expr pieces because they are
// primary-expressions.
- return ParsePostfixExpressionSuffix(Res.move());
+ return ParsePostfixExpressionSuffix(Res.result());
}
/// ParseParenExpression - This parses the unit that starts with a '(' token,
@@ -1042,7 +1044,7 @@ Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
// If the substmt parsed correctly, build the AST node.
if (!Stmt.isInvalid() && Tok.is(tok::r_paren))
Result = Actions.ActOnStmtExpr(
- OpenLoc, Stmt.move(), Tok.getLocation());
+ OpenLoc, Stmt.release(), Tok.getLocation());
} else if (ExprType >= CompoundLiteral && isTypeIdInParens()) {
// Otherwise, this is a compound literal expression or cast expression.
@@ -1061,7 +1063,7 @@ Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
ExprType = CompoundLiteral;
if (!Result.isInvalid())
return Actions.ActOnCompoundLiteral(OpenLoc, Ty, RParenLoc,
- Result.move());
+ Result.release());
} else if (ExprType == CastExpr) {
// Note that this doesn't parse the subsequence cast-expression, it just
// returns the parsed type to the callee.
@@ -1072,13 +1074,13 @@ Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
return ExprResult(true);
}
- return Result.move();
+ return Result.result();
} else {
Result = ParseExpression();
ExprType = SimpleExpr;
if (!Result.isInvalid() && Tok.is(tok::r_paren))
Result = Actions.ActOnParenExpr(
- OpenLoc, Tok.getLocation(), Result.move());
+ OpenLoc, Tok.getLocation(), Result.release());
}
// Match the ')'.
@@ -1091,7 +1093,7 @@ Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
MatchRHSPunctuation(tok::r_paren, OpenLoc);
}
- return Result.move();
+ return Result.result();
}
/// ParseStringLiteralExpression - This handles the various token types that
@@ -1132,7 +1134,7 @@ bool Parser::ParseExpressionList(ExprListTy &Exprs, CommaLocsTy &CommaLocs) {
if (Expr.isInvalid())
return true;
- Exprs.push_back(Expr.move());
+ Exprs.push_back(Expr.release());
if (Tok.isNot(tok::comma))
return false;
@@ -1193,12 +1195,12 @@ Parser::ExprResult Parser::ParseBlockLiteralExpression() {
if (Tok.is(tok::l_brace)) {
OwningStmtResult Stmt(Actions, ParseCompoundStatementBody());
if (!Stmt.isInvalid()) {
- Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.move(), CurScope);
+ Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.release(), CurScope);
} else {
Actions.ActOnBlockError(CaretLoc, CurScope);
}
}
ExitScope();
- return Result.move();
+ return Result.result();
}
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index e28ddc7485..8dd2f515dd 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -226,9 +226,9 @@ Parser::ExprResult Parser::ParseCXXCasts() {
if (!Result.isInvalid())
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
LAngleBracketLoc, CastTy, RAngleBracketLoc,
- LParenLoc, Result.move(), RParenLoc);
+ LParenLoc, Result.release(), RParenLoc);
- return Result.move();
+ return Result.result();
}
/// ParseCXXTypeid - This handles the C++ typeid expression.
@@ -272,11 +272,11 @@ Parser::ExprResult Parser::ParseCXXTypeid() {
MatchRHSPunctuation(tok::r_paren, LParenLoc);
Result = Actions.ActOnCXXTypeid(OpLoc, LParenLoc, /*isType=*/false,
- Result.move(), RParenLoc);
+ Result.release(), RParenLoc);
}
}
- return Result.move();
+ return Result.result();
}
/// ParseCXXBoolLiteral - This handles the C++ Boolean literals.
@@ -311,8 +311,8 @@ Parser::ExprResult Parser::ParseThrowExpression() {
default:
OwningExprResult Expr(Actions, ParseAssignmentExpression());
- if (Expr.isInvalid()) return Expr.move();
- return Actions.ActOnCXXThrow(ThrowLoc, Expr.move());
+ if (Expr.isInvalid()) return Expr.result();
+ return Actions.ActOnCXXThrow(ThrowLoc, Expr.release());
}
}
@@ -388,12 +388,12 @@ Parser::ExprResult Parser::ParseCXXCondition() {
// simple-asm-expr[opt]
if (Tok.is(tok::kw_asm)) {
- OwningExprResult AsmLabel(Actions, ParseSimpleAsm());
+ OwningExprResult AsmLabel(ParseSimpleAsm());
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi);
return true;
}
- DeclaratorInfo.setAsmLabel(AsmLabel.move());
+ DeclaratorInfo.setAsmLabel(AsmLabel.release());
}
// If attributes are present, parse them.
@@ -409,8 +409,8 @@ Parser::ExprResult Parser::ParseCXXCondition() {
return true;
return Actions.ActOnCXXConditionDeclarationExpr(CurScope, StartLoc,
- DeclaratorInfo,
- EqualLoc, AssignExpr.move());
+ DeclaratorInfo, EqualLoc,
+ AssignExpr.release());
}
/// ParseCXXSimpleTypeSpecifier - [C++ 7.1.5.2] Simple type specifiers.
@@ -786,7 +786,7 @@ void Parser::ParseDirectNewDeclarator(Declarator &D)
first = false;
D.AddTypeInfo(DeclaratorChunk::getArray(0, /*static=*/false, /*star=*/false,
- Size.move(), LLoc));
+ Size.release(), LLoc));
if (MatchRHSPunctuation(tok::r_square, LLoc).isInvalid())
return;
@@ -853,7 +853,8 @@ Parser::ExprResult Parser::ParseCXXDeleteExpression()
OwningExprResult Operand(Actions, ParseCastExpression(false));
if (Operand.isInvalid())
- return Operand.move();
+ return Operand.result();
- return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, Operand.move());
+ return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete,
+ Operand.release());
}
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 39b43fa201..01d1d0b22d 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -146,7 +146,7 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
OwningExprResult Idx(Actions, ParseAssignmentExpression());
if (Idx.isInvalid()) {
SkipUntil(tok::r_square);
- return Idx.move();
+ return Idx.result();
}
// Given an expression, we could either have a designator (if the next
@@ -170,7 +170,7 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
- 0, Idx.move());
+ 0, Idx.release());
}
// Create designation if we haven't already.
@@ -179,7 +179,7 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
// If this is a normal array designator, remember it.
if (Tok.isNot(tok::ellipsis)) {
- Desig->AddDesignator(Designator::getArray(Idx.move()));
+ Desig->AddDesignator(Designator::getArray(Idx.release()));
} else {
// Handle the gnu array range extension.
Diag(Tok, diag::ext_gnu_array_range);
@@ -188,9 +188,10 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
OwningExprResult RHS(Actions, ParseConstantExpression());
if (RHS.isInvalid()) {
SkipUntil(tok::r_square);
- return RHS.move();
+ return RHS.result();
}
- Desig->AddDesignator(Designator::getArrayRange(Idx.move(), RHS.move()));
+ Desig->AddDesignator(Designator::getArrayRange(Idx.release(),
+ RHS.release()));
}
MatchRHSPunctuation(tok::r_square, StartLoc);
@@ -280,7 +281,7 @@ Parser::ExprResult Parser::ParseBraceInitializer() {
// If we couldn't parse the subelement, bail out.
if (!SubElt.isInvalid()) {
- InitExprs.push_back(SubElt.move());
+ InitExprs.push_back(SubElt.release());
} else {
InitExprsOk = false;
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 7ca11eb3cd..c6bc386d6b 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1185,7 +1185,7 @@ Parser::StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
}
}
ConsumeToken(); // consume ';'
- return Actions.ActOnObjCAtThrowStmt(atLoc, Res.move());
+ return Actions.ActOnObjCAtThrowStmt(atLoc, Res.release());
}
/// objc-synchronized-statement:
@@ -1221,8 +1221,8 @@ Parser::StmtResult Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
ExitScope();
if (SynchBody.isInvalid())
SynchBody = Actions.ActOnNullStmt(Tok.getLocation());
- return Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.move(),
- SynchBody.move());
+ return Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.release(),
+ SynchBody.release());
}
/// objc-try-catch-statement:
@@ -1295,7 +1295,8 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
CatchStmts = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
- RParenLoc, FirstPart.move(), CatchBody.move(), CatchStmts.move());
+ RParenLoc, FirstPart.release(), CatchBody.release(),
+ CatchStmts.release());
ExitScope();
} else {
Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
@@ -1317,7 +1318,7 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (FinallyBody.isInvalid())
FinallyBody = Actions.ActOnNullStmt(Tok.getLocation());
FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc,
- FinallyBody.move());
+ FinallyBody.release());
catch_or_finally_seen = true;
ExitScope();
break;
@@ -1327,8 +1328,9 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
Diag(atLoc, diag::err_missing_catch_finally);
return true;
}
- return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.move(), CatchStmts.move(),
- FinallyStmt.move());
+ return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.release(),
+ CatchStmts.release(),
+ FinallyStmt.release());
}
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
@@ -1369,7 +1371,7 @@ Parser::DeclTy *Parser::ParseObjCMethodDefinition() {
ExitScope();
// TODO: Pass argument information.
- Actions.ActOnFinishFunctionBody(MDecl, FnBody.move());
+ Actions.ActOnFinishFunctionBody(MDecl, FnBody.release());
return MDecl;
}
@@ -1390,7 +1392,7 @@ Parser::StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
}
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(Res.move());
+ return Actions.ActOnExprStmt(Res.release