diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-14 00:16:25 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-14 00:16:25 +0000 |
commit | db2910427287a5c5e2e7e20d61982d8747b605ca (patch) | |
tree | 86b8f538321257b6704e69ad2fa22a4a0b1fd779 /lib/CodeGen/CGCXX.cpp | |
parent | a2a416150455d049e8663227fbe7c30c2a948618 (diff) |
Handle delete where the class has a virtual destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 4932692ffd..25e2b13e06 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -608,11 +608,14 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { 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); } } } |