diff options
author | Mike Stump <mrs@apple.com> | 2009-12-10 00:02:42 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-12-10 00:02:42 +0000 |
commit | f5cbb08c4b7646eb0ef92950ef0be75f26ac7522 (patch) | |
tree | c743b5f1f66fad94153b2f2209d6afcecdee7d71 /clang/lib/CodeGen | |
parent | 3b60f034f9f850ad2e92fd966f6dda419c91b3b8 (diff) | |
download | bcm5719-llvm-f5cbb08c4b7646eb0ef92950ef0be75f26ac7522.tar.gz bcm5719-llvm-f5cbb08c4b7646eb0ef92950ef0be75f26ac7522.zip |
Ensure we only generate one terminate handler.
llvm-svn: 90998
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 13780b39bba..9f4d50ccb7c 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/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 diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index adfd75b42a7..18442bb1590 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -31,7 +31,7 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) DebugInfo(0), IndirectBranch(0), SwitchInsn(0), CaseRangeBlock(0), InvokeDest(0), CXXThisDecl(0), CXXVTTDecl(0), - ConditionalBranchLevel(0) { + ConditionalBranchLevel(0), TerminateHandler(0) { LLVMIntTy = ConvertType(getContext().IntTy); LLVMPointerWidth = Target.getPointerWidth(0); Exceptions = getContext().getLangOptions().Exceptions; diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 7ef3ad0422f..cf267c41676 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -422,6 +422,8 @@ private: /// getByrefValueFieldNumber - Given a declaration, returns the LLVM field /// number that holds the value. unsigned getByRefValueLLVMField(const ValueDecl *VD) const; + + llvm::BasicBlock *TerminateHandler; public: CodeGenFunction(CodeGenModule &cgm); @@ -552,6 +554,7 @@ public: /// EmitEndEHSpec - Emit the end of the exception spec. void EmitEndEHSpec(const Decl *D); + /// getTerminateHandler - Return a handler that just calls terminate. llvm::BasicBlock *getTerminateHandler(); const llvm::Type *ConvertTypeForMem(QualType T); |