aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExprCXX.cpp
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/ParseExprCXX.cpp
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/ParseExprCXX.cpp')
-rw-r--r--lib/Parse/ParseExprCXX.cpp27
1 files changed, 14 insertions, 13 deletions
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());
}