Ensure we only generate one terminate handler.
llvm-svn: 90998
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp
index 13780b3..9f4d50c 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -683,6 +683,9 @@
}
llvm::BasicBlock *CodeGenFunction::getTerminateHandler() {
+ if (TerminateHandler)
+ return TerminateHandler;
+
llvm::BasicBlock *Cont = 0;
if (HaveInsertPoint()) {
@@ -702,7 +705,7 @@
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