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
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 39b43fa..01d1d0b 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -146,7 +146,7 @@
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 @@
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
- 0, Idx.move());
+ 0, Idx.release());
}
// Create designation if we haven't already.
@@ -179,7 +179,7 @@
// 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 @@
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 @@
// 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;