diff options
author | Anders Carlsson <andersca@mac.com> | 2009-08-18 16:11:00 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-08-18 16:11:00 +0000 |
commit | f53b4433abb7a3bc14c0329d3175cbc291280137 (patch) | |
tree | 3317c19d86123867b103180d2602de3c4f5af700 /lib/Sema/SemaStmt.cpp | |
parent | 292a5c04694ebf0cfcf41f5afe7e3db27019260e (diff) |
Change ActOnReturnStmt to not take a FullExprArg. Instead, Sema will wrap the return expr inside a CXXExprWithTemporaries if needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 579433849e..d1bb0df00d 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -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)); } |