From: Mike Stump Date: Fri, 4 Dec 2009 19:21:57 +0000 (+0000) Subject: Fixup nested try blocks. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2c9c0b1c5e25cfbee1403cde12b98f180e6b315;p=clang Fixup nested try blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90576 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 3de300445c..62064ecf41 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -481,8 +481,18 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) { EmitBranch(FinallyEnd); EmitBlock(FinallyRethrow); - Builder.CreateCall(getUnwindResumeOrRethrowFn(*this), - Builder.CreateLoad(RethrowPtr)); + // FIXME: Eventually we can chain the handlers together and just do a call + // here. + if (getInvokeDest()) { + llvm::BasicBlock *Cont = createBasicBlock("invoke.cont"); + Builder.CreateInvoke(getUnwindResumeOrRethrowFn(*this), Cont, + getInvokeDest(), + Builder.CreateLoad(RethrowPtr)); + EmitBlock(Cont); + } else + Builder.CreateCall(getUnwindResumeOrRethrowFn(*this), + Builder.CreateLoad(RethrowPtr)); + Builder.CreateUnreachable(); EmitBlock(FinallyEnd);