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/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 242c1b3..e7f4fc9 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -132,7 +132,7 @@
                 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 @@
                 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 @@
   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 @@
         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 @@
       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 @@
                                                       LastEnumConstDecl,
                                                       IdentLoc, Ident,
                                                       EqualLoc,
-                                                      AssignedVal.move());
+                                                      AssignedVal.release());
     EnumConstantDecls.push_back(EnumConstDecl);
     LastEnumConstDecl = EnumConstDecl;
     
@@ -1802,7 +1802,7 @@
         } else {
           // Inform the actions module about the default argument
           Actions.ActOnParamDefaultArgument(Param, EqualLoc,
-                                            DefArgResult.move());
+                                            DefArgResult.release());
         }
       }
       
@@ -1973,7 +1973,7 @@
   // 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 @@
     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 @@
     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);