[cfe-commits] r81733 - /cfe/trunk/lib/CodeGen/CGCXX.cpp
Anders Carlsson
andersca at mac.com
Sun Sep 13 17:16:25 PDT 2009
Author: andersca
Date: Sun Sep 13 19:16:25 2009
New Revision: 81733
URL: http://llvm.org/viewvc/llvm-project?rev=81733&view=rev
Log:
Handle delete where the class has a virtual destructor.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=81733&r1=81732&r2=81733&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sun Sep 13 19:16:25 2009
@@ -608,11 +608,14 @@
if (!RD->hasTrivialDestructor()) {
const CXXDestructorDecl *Dtor = RD->getDestructor(getContext());
if (Dtor->isVirtual()) {
- ErrorUnsupported(E, "delete expression with virtual destructor");
- return;
- }
-
- EmitCXXDestructorCall(Dtor, Dtor_Complete, Ptr);
+ const llvm::Type *Ty =
+ CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(Dtor),
+ /*isVariadic=*/false);
+
+ llvm::Value *Callee = BuildVirtualCall(Dtor, Ptr, Ty);
+ EmitCXXMemberCall(Dtor, Callee, Ptr, 0, 0);
+ } else
+ EmitCXXDestructorCall(Dtor, Dtor_Complete, Ptr);
}
}
}
More information about the cfe-commits
mailing list