[cfe-commits] r90998 - in /cfe/trunk/lib/CodeGen: CGException.cpp CodeGenFunction.cpp CodeGenFunction.h
Mike Stump
mrs at apple.com
Wed Dec 9 16:02:42 PST 2009
Author: mrs
Date: Wed Dec 9 18:02:42 2009
New Revision: 90998
URL: http://llvm.org/viewvc/llvm-project?rev=90998&view=rev
Log:
Ensure we only generate one terminate handler.
Modified:
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=90998&r1=90997&r2=90998&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Dec 9 18:02:42 2009
@@ -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
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=90998&r1=90997&r2=90998&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Dec 9 18:02:42 2009
@@ -31,7 +31,7 @@
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;
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=90998&r1=90997&r2=90998&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Dec 9 18:02:42 2009
@@ -422,6 +422,8 @@
/// 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 @@
/// 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);
More information about the cfe-commits
mailing list