Put the invalid flag of OwningResult into the Action pointer.
This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two.
This leads to simpler client code and speeds up my benchmark by 2.7%.
For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63867 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 5ff0905..a830399 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -118,7 +118,7 @@
       }
       // Otherwise, eat the semicolon.
       ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
-      return Actions.ActOnExprStmt(move_arg(Expr));
+      return Actions.ActOnExprStmt(move(Expr));
     }
 
   case tok::kw_case:                // C99 6.8.1: labeled-statement
@@ -217,7 +217,7 @@
 
   return Actions.ActOnLabelStmt(IdentTok.getLocation(),
                                 IdentTok.getIdentifierInfo(),
-                                ColonLoc, move_arg(SubStmt));
+                                ColonLoc, move(SubStmt));
 }
 
 /// ParseCaseStatement
@@ -271,8 +271,8 @@
   if (SubStmt.isInvalid())
     SubStmt = Actions.ActOnNullStmt(ColonLoc);
 
-  return Actions.ActOnCaseStmt(CaseLoc, move_arg(LHS), DotDotDotLoc,
-                               move_arg(RHS), ColonLoc, move_arg(SubStmt));
+  return Actions.ActOnCaseStmt(CaseLoc, move(LHS), DotDotDotLoc,
+                               move(RHS), ColonLoc, move(SubStmt));
 }
 
 /// ParseDefaultStatement
@@ -303,7 +303,7 @@
     return StmtError();
 
   return Actions.ActOnDefaultStmt(DefaultLoc, ColonLoc,
-                                  move_arg(SubStmt), CurScope);
+                                  move(SubStmt), CurScope);
 }
 
 
@@ -393,7 +393,7 @@
         // Eat the semicolon at the end of stmt and convert the expr into a
         // statement.
         ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
-        R = Actions.ActOnExprStmt(move_arg(Res));
+        R = Actions.ActOnExprStmt(move(Res));
       }
     }
 
@@ -568,8 +568,8 @@
   if (ElseStmt.isInvalid())
     ElseStmt = Actions.ActOnNullStmt(ElseStmtLoc);
 
-  return Actions.ActOnIfStmt(IfLoc, move_arg(CondExp), move_arg(ThenStmt),
-                             ElseLoc, move_arg(ElseStmt));
+  return Actions.ActOnIfStmt(IfLoc, move(CondExp), move(ThenStmt),
+                             ElseLoc, move(ElseStmt));
 }
 
 /// ParseSwitchStatement
@@ -612,7 +612,7 @@
 
   OwningStmtResult Switch(Actions);
   if (!Cond.isInvalid())
-    Switch = Actions.ActOnStartOfSwitchStmt(move_arg(Cond));
+    Switch = Actions.ActOnStartOfSwitchStmt(move(Cond));
 
   // C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
@@ -644,8 +644,7 @@
   if (Cond.isInvalid())
     return StmtError();
 
-  return Actions.ActOnFinishSwitchStmt(SwitchLoc, move_arg(Switch),
-                                       move_arg(Body));
+  return Actions.ActOnFinishSwitchStmt(SwitchLoc, move(Switch), move(Body));
 }
 
 /// ParseWhileStatement
@@ -714,7 +713,7 @@
   if (Cond.isInvalid() || Body.isInvalid())
     return StmtError();
 
-  return Actions.ActOnWhileStmt(WhileLoc, move_arg(Cond), move_arg(Body));
+  return Actions.ActOnWhileStmt(WhileLoc, move(Cond), move(Body));
 }
 
 /// ParseDoStatement
@@ -778,7 +777,7 @@
   if (Cond.isInvalid() || Body.isInvalid())
     return StmtError();
 
-  return Actions.ActOnDoStmt(DoLoc, move_arg(Body), WhileLoc, move_arg(Cond));
+  return Actions.ActOnDoStmt(DoLoc, move(Body), WhileLoc, move(Cond));
 }
 
 /// ParseForStatement
@@ -860,7 +859,7 @@
 
     // Turn the expression into a stmt.
     if (!Value.isInvalid())
-      FirstPart = Actions.ActOnExprStmt(move_arg(Value));
+      FirstPart = Actions.ActOnExprStmt(move(Value));
 
     if (Tok.is(tok::semi)) {
       ConsumeToken();
@@ -927,14 +926,14 @@
     return StmtError();
 
   if (!ForEach)
-    return Actions.ActOnForStmt(ForLoc, LParenLoc, move_arg(FirstPart),
-                              move_arg(SecondPart), move_arg(ThirdPart),
-                              RParenLoc, move_arg(Body));
+    return Actions.ActOnForStmt(ForLoc, LParenLoc, move(FirstPart),
+                              move(SecondPart), move(ThirdPart),
+                              RParenLoc, move(Body));
   else
     return Actions.ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
-                                              move_arg(FirstPart),
-                                              move_arg(SecondPart),
-                                              RParenLoc, move_arg(Body));
+                                              move(FirstPart),
+                                              move(SecondPart),
+                                              RParenLoc, move(Body));
 }
 
 /// ParseGotoStatement
@@ -962,7 +961,7 @@
       SkipUntil(tok::semi, false, true);
       return StmtError();
     }
-    Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, move_arg(R));
+    Res = Actions.ActOnIndirectGotoStmt(GotoLoc, StarLoc, move(R));
   } else {
     Diag(Tok, diag::err_expected_ident);
     return StmtError();
@@ -1008,7 +1007,7 @@
       return StmtError();
     }
   }
-  return Actions.ActOnReturnStmt(ReturnLoc, move_arg(R));
+  return Actions.ActOnReturnStmt(ReturnLoc, move(R));
 }
 
 /// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
@@ -1148,7 +1147,7 @@
   return Actions.ActOnAsmStmt(AsmLoc, isSimple, isVolatile,
                               NumOutputs, NumInputs, &Names[0],
                               move_arg(Constraints), move_arg(Exprs),
-                              move_arg(AsmString), move_arg(Clobbers),
+                              move(AsmString), move_arg(Clobbers),
                               RParenLoc);
 }
 
@@ -1233,7 +1232,7 @@
   if (FnBody.isInvalid())
     FnBody = Actions.ActOnCompoundStmt(L, R, MultiStmtArg(Actions), false);
 
-  return Actions.ActOnFinishFunctionBody(Decl, move_arg(FnBody));
+  return Actions.ActOnFinishFunctionBody(Decl, move(FnBody));
 }
 
 /// ParseCXXTryBlock - Parse a C++ try-block.
@@ -1267,8 +1266,7 @@
   if (Handlers.empty())
     return StmtError();
 
-  return Actions.ActOnCXXTryBlock(TryLoc, move_arg(TryBlock),
-                                  move_arg(Handlers));
+  return Actions.ActOnCXXTryBlock(TryLoc, move(TryBlock), move_arg(Handlers));
 }
 
 /// ParseCXXCatchBlock - Parse a C++ catch block, called handler in the standard
@@ -1319,5 +1317,5 @@
   if (Block.isInvalid())
     return move(Block);
 
-  return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, move_arg(Block));
+  return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, move(Block));
 }