diff options
author | Anders Carlsson <andersca@mac.com> | 2010-01-29 18:30:20 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-01-29 18:30:20 +0000 |
commit | c6acbc58a7aef0a3382775424c80e9534b54b2ed (patch) | |
tree | 5250a0d8f441f432fbc3ef9612f3338b16afc0f4 /lib/Sema/SemaStmt.cpp | |
parent | 3dd96a1489498deb03208f7011f48b9f3d7901db (diff) |
Get rid of another old PerformCopyInitialization call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index ca15de2cf2..4e3e038144 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -991,11 +991,19 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // In C++ the return statement is handled via a copy initialization. // the C version of which boils down to CheckSingleAssignmentConstraints. - // FIXME: Leaks RetValExp. - if (PerformCopyInitialization(RetValExp, FnRetType, AA_Returning)) + OwningExprResult Res = PerformCopyInitialization( + InitializedEntity::InitializeResult(ReturnLoc, + FnRetType), + SourceLocation(), + Owned(RetValExp)); + if (Res.isInvalid()) { + // FIXME: Cleanup temporaries here, anyway? return StmtError(); - - if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc); + } + + RetValExp = Res.takeAs<Expr>(); + if (RetValExp) + CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc); } return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp)); |