PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2011-08-02 18:05:30 +00:00
Родитель 2b81910618
Коммит aebab72698
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -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;
}
}