[cfe-commits] r91035 - /cfe/trunk/lib/CodeGen/CGException.cpp
Mike Stump
mrs at apple.com
Wed Dec 9 17:52:31 PST 2009
Author: mrs
Date: Wed Dec 9 19:52:30 2009
New Revision: 91035
URL: http://llvm.org/viewvc/llvm-project?rev=91035&view=rev
Log:
Setup cleanup on eh edge out of the construction of the cleanup object
during throw to deallocate the exception object. WIP.
Modified:
cfe/trunk/lib/CodeGen/CGException.cpp
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=91035&r1=91034&r2=91035&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Dec 9 19:52:30 2009
@@ -146,27 +146,21 @@
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
More information about the cfe-commits
mailing list