From 182f383db1782af752ecaf607fdff72a8542088b Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Thu, 10 Dec 2009 00:02:42 +0000 Subject: Ensure we only generate one terminate handler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90998 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGException.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGException.cpp') diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 13780b39bb..9f4d50ccb7 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -683,6 +683,9 @@ CodeGenFunction::EHCleanupBlock::~EHCleanupBlock() { } llvm::BasicBlock *CodeGenFunction::getTerminateHandler() { + if (TerminateHandler) + return TerminateHandler; + llvm::BasicBlock *Cont = 0; if (HaveInsertPoint()) { @@ -702,7 +705,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateHandler() { CGM.getIntrinsic(llvm::Intrinsic::eh_selector); // Set up terminate handler - llvm::BasicBlock *TerminateHandler = createBasicBlock("terminate.handler"); + TerminateHandler = createBasicBlock("terminate.handler"); EmitBlock(TerminateHandler); llvm::Value *Exc = Builder.CreateCall(llvm_eh_exception, "exc"); // We are required to emit this call to satisfy LLVM, even -- cgit v1.2.3-70-g09d2