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/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index e28ddc7..8dd2f51 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -226,9 +226,9 @@
   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 @@
       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 @@
 
   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 @@
 
   // 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 @@
     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 @@
     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 @@
 
   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());
 }