[cfe-commits] r95502 - /cfe/trunk/lib/CodeGen/CGClass.cpp
Anders Carlsson
andersca at mac.com
Sat Feb 6 12:00:21 PST 2010
Author: andersca
Date: Sat Feb 6 14:00:21 2010
New Revision: 95502
URL: http://llvm.org/viewvc/llvm-project?rev=95502&view=rev
Log:
Call destructors for constructed bases as well.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=95502&r1=95501&r2=95502&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Feb 6 14:00:21 2010
@@ -809,6 +809,19 @@
V = CGF.Builder.CreateConstInBoundsGEP1_64(V, Offset/8);
V = CGF.Builder.CreateBitCast(V, BaseClassType->getPointerTo());
CGF.EmitAggExpr(BaseInit->getInit(), V, false, false, true);
+
+ if (CGF.Exceptions && !BaseClassDecl->hasTrivialDestructor()) {
+ // FIXME: Is this OK for C++0x delegating constructors?
+ CodeGenFunction::EHCleanupBlock Cleanup(CGF);
+
+ llvm::Value *ThisPtr = CGF.LoadCXXThis();
+ llvm::Value *V = CGF.Builder.CreateBitCast(ThisPtr, Int8PtrTy);
+ V = CGF.Builder.CreateConstInBoundsGEP1_64(V, Offset / 8);
+ V = CGF.Builder.CreateBitCast(V, BaseClassType->getPointerTo());
+
+ CXXDestructorDecl *DD = BaseClassDecl->getDestructor(CGF.getContext());
+ CGF.EmitCXXDestructorCall(DD, Dtor_Base, V);
+ }
}
static void EmitMemberInitializer(CodeGenFunction &CGF,
More information about the cfe-commits
mailing list