]> granicus.if.org Git - clang/commitdiff
When extending the lifetime of a temporary, make sure to emit a branch to the cleanup...
authorAnders Carlsson <andersca@mac.com>
Fri, 11 Dec 2009 01:00:09 +0000 (01:00 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 11 Dec 2009 01:00:09 +0000 (01:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91086 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index 873c28cdef845e37f1f7231db4cc282d4cf152dd..0f351be01c2a9c21249782a4c536c754417a4585 100644 (file)
@@ -138,9 +138,12 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
               ClassDecl->getDestructor(getContext());
 
             {
-              DelayedCleanupBlock scope(*this);
+              DelayedCleanupBlock Scope(*this);
               EmitCXXDestructorCall(Dtor, Dtor_Complete,
                                     Val.getAggregateAddr());
+              
+              // Make sure to jump to the exit block.
+              EmitBranch(Scope.getCleanupExitBlock());
             }
             if (Exceptions) {
               EHCleanupBlock Cleanup(*this);