forked from OSchip/llvm-project
PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.
llvm-svn: 136703
This commit is contained in:
parent
be10f9853c
commit
b23533db13
|
@ -1206,7 +1206,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF,
|
|||
const CXXDestructorDecl *Dtor = 0;
|
||||
if (const RecordType *RT = ElementType->getAs<RecordType>()) {
|
||||
CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
|
||||
if (!RD->hasTrivialDestructor()) {
|
||||
if (RD->hasDefinition() && !RD->hasTrivialDestructor()) {
|
||||
Dtor = RD->getDestructor();
|
||||
|
||||
if (Dtor->isVirtual()) {
|
||||
|
|
|
@ -125,9 +125,11 @@ namespace test4 {
|
|||
|
||||
namespace test5 {
|
||||
struct Incomplete;
|
||||
// CHECK: define void @_ZN5test523array_delete_incompleteEPNS_10IncompleteE
|
||||
void array_delete_incomplete(Incomplete *p) {
|
||||
// CHECK: define void @_ZN5test523array_delete_incompleteEPNS_10IncompleteES1_
|
||||
void array_delete_incomplete(Incomplete *p1, Incomplete *p2) {
|
||||
// CHECK: call void @_ZdlPv
|
||||
delete p1;
|
||||
// CHECK: call void @_ZdaPv
|
||||
delete [] p;
|
||||
delete [] p2;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue