From: Mike Stump Date: Fri, 4 Dec 2009 19:03:47 +0000 (+0000) Subject: Fix warning and be sure to set up the rethrow pointer if we fall off X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a086783570f76062a345e761811296dc8df571c8;p=clang Fix warning and be sure to set up the rethrow pointer if we fall off the end of all the catches. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90574 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 2374d91a2b..3de300445c 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -138,7 +138,7 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E, llvm::Value *N) { // CodeGenFunction::CleanupScope TryScope(CGF); { // These actions are only on the exceptional edge. -#if 0 + if (0) { // FIXME: Doesn't work well with eh31.C and PopCXXTemporary CodeGenFunction::DelayedCleanupBlock Scope(CGF, true); @@ -147,7 +147,7 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E, llvm::Value *N) { = llvm::Type::getInt8PtrTy(CGF.getLLVMContext()); llvm::Value *ExceptionPtr = CGF.Builder.CreateBitCast(N, Int8PtrTy); CGF.Builder.CreateCall(FreeExceptionFn, ExceptionPtr); -#endif + } } llvm::Value *Src = CGF.EmitLValue(E).getAddress(); @@ -461,8 +461,10 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) { if (Next) EmitBlock(Next); } - if (!HasCatchAll) + if (!HasCatchAll) { + Builder.CreateStore(Exc, RethrowPtr); EmitBranchThroughCleanup(FinallyRethrow); + } CodeGenFunction::CleanupBlockInfo Info = PopCleanupBlock();