forked from OSchip/llvm-project
Handle delete where the class has a virtual destructor.
llvm-svn: 81733
This commit is contained in:
parent
125f8fb761
commit
8783737029
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue