aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGException.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-12-10 01:52:30 +0000
committerMike Stump <mrs@apple.com>2009-12-10 01:52:30 +0000
commit5030a98e20e7501366cf50a7e8b92dc016b98bfb (patch)
tree90ce32195d0f92dad78e2906430b3d0bc398dbdc /lib/CodeGen/CGException.cpp
parentf2c8e7dee981353cef2fc102d1f96f1cd0d30f64 (diff)
Setup cleanup on eh edge out of the construction of the cleanup object
during throw to deallocate the exception object. WIP. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGException.cpp')
-rw-r--r--lib/CodeGen/CGException.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 87f4eb0f11..d61884ce02 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -146,27 +146,21 @@ static void CopyObject(CodeGenFunction &CGF, const Expr *E, llvm::Value *N) {
CGF.EmitAggExpr(E, This, false);
} else if (CXXConstructorDecl *CopyCtor
= RD->getCopyConstructor(CGF.getContext(), 0)) {
- // All temporaries end before we call __cxa_throw
- // FIXME: Doesn't work well with eh31.C and PopCXXTemporary
- // CodeGenFunction::CleanupScope TryScope(CGF);
- {
- // These actions are only on the exceptional edge.
- if (0) {
- // FIXME: Doesn't work well with eh31.C and PopCXXTemporary
- CodeGenFunction::DelayedCleanupBlock Scope(CGF, true);
-
+ llvm::BasicBlock *PrevLandingPad = CGF.getInvokeDest();
+ if (CGF.Exceptions) {
+ CodeGenFunction::EHCleanupBlock Cleanup(CGF);
llvm::Constant *FreeExceptionFn = getFreeExceptionFn(CGF);
const llvm::Type *Int8PtrTy
= llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
llvm::Value *ExceptionPtr = CGF.Builder.CreateBitCast(N, Int8PtrTy);
CGF.Builder.CreateCall(FreeExceptionFn, ExceptionPtr);
- }
}
-
+
llvm::Value *Src = CGF.EmitLValue(E).getAddress();
+ CGF.setInvokeDest(PrevLandingPad);
llvm::BasicBlock *TerminateHandler = CGF.getTerminateHandler();
- llvm::BasicBlock *PrevLandingPad = CGF.getInvokeDest();
+ PrevLandingPad = CGF.getInvokeDest();
CGF.setInvokeDest(TerminateHandler);
// Stolen from EmitClassAggrMemberwiseCopy