]> granicus.if.org Git - clang/commitdiff
Change ActOnReturnStmt to not take a FullExprArg. Instead, Sema will wrap the return...
authorAnders Carlsson <andersca@mac.com>
Tue, 18 Aug 2009 16:11:00 +0000 (16:11 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 18 Aug 2009 16:11:00 +0000 (16:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79342 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Action.h
lib/Frontend/PrintParserCallbacks.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/Sema.h
lib/Sema/SemaStmt.cpp
lib/Sema/SemaTemplateInstantiateStmt.cpp

index 870613998822977d7dfe16cbe740c0c59f64e55b..70f5dbb9293a83382b6fe6a293566efbb0a7fa32 100644 (file)
@@ -641,7 +641,7 @@ public:
     return StmtEmpty();
   }
   virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
-                                           FullExprArg RetValExp) {
+                                           ExprArg RetValExp) {
     return StmtEmpty();
   }
   virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
index 9d6ea73eefb1fed89614318b97d54116ab0f9e8b..126cdd3fdd4d2377154cdf9171772bf6584611bf 100644 (file)
@@ -374,7 +374,7 @@ namespace {
       return StmtEmpty();
     }
     virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
-                                             FullExprArg RetValExp) {
+                                             ExprArg RetValExp) {
       Out << __FUNCTION__ << "\n";
       return StmtEmpty();
     }
index 955f00d7a0b5fc41113b6dd08a3299ee0a15202b..4a7bd57d786a347b2d03a8c224f44e7e9d8c4ded 100644 (file)
@@ -1085,7 +1085,7 @@ Parser::OwningStmtResult Parser::ParseReturnStatement() {
       return StmtError();
     }
   }
-  return Actions.ActOnReturnStmt(ReturnLoc, Actions.FullExpr(R));
+  return Actions.ActOnReturnStmt(ReturnLoc, move(R));
 }
 
 /// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
index d3bdec8f39edc7b49e7620d1c5454acb3af55c24..9230531b31616c67e57e5e6c5bf9cb7da3cce423 100644 (file)
@@ -1366,7 +1366,7 @@ public:
                                           Scope *CurScope);
 
   virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
-                                           FullExprArg RetValExp);
+                                           ExprArg RetValExp);
   OwningStmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc,
                                         Expr *RetValExp);
 
index 579433849e6c7f0df91c3b24e5ee02d0b27f0606..d1bb0df00d5bdfd2e742eb6f7f563b2eb4f0e64b 100644 (file)
@@ -867,8 +867,8 @@ static bool IsReturnCopyElidable(ASTContext &Ctx, QualType RetType,
 }
 
 Action::OwningStmtResult
-Sema::ActOnReturnStmt(SourceLocation ReturnLoc, FullExprArg rex) {
-  Expr *RetValExp = rex->takeAs<Expr>();
+Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) {
+  Expr *RetValExp = rex.takeAs<Expr>();
   if (CurBlock)
     return ActOnBlockReturnStmt(ReturnLoc, RetValExp);
 
@@ -897,6 +897,8 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, FullExprArg rex) {
           << CurDecl->getDeclName() << isa<ObjCMethodDecl>(CurDecl)
           << RetValExp->getSourceRange();
       }
+      
+      RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
     }
     return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
   }
@@ -945,6 +947,8 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, FullExprArg rex) {
     if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
   }
 
+  if (RetValExp)
+    RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
   return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
 }
 
index 80ff5eb082a92cda39e2c11b1292abb7d5293f4c..b42b84d7952680e315f168b10d0932eea0c533e5 100644 (file)
@@ -130,7 +130,7 @@ TemplateStmtInstantiator::VisitReturnStmt(ReturnStmt *S) {
       return SemaRef.StmtError();
   }
   
-  return SemaRef.ActOnReturnStmt(S->getReturnLoc(), FullExpr(Result));
+  return SemaRef.ActOnReturnStmt(S->getReturnLoc(), move(Result));
 }
 
 Sema::OwningStmtResult