[cfe-commits] r136703 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/delete.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Aug 2 11:05:30 PDT 2011
Author: efriedma
Date: Tue Aug 2 13:05:30 2011
New Revision: 136703
URL: http://llvm.org/viewvc/llvm-project?rev=136703&view=rev
Log:
PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenCXX/delete.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=136703&r1=136702&r2=136703&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Aug 2 13:05:30 2011
@@ -1206,7 +1206,7 @@
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()) {
Modified: cfe/trunk/test/CodeGenCXX/delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/delete.cpp?rev=136703&r1=136702&r2=136703&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/delete.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/delete.cpp Tue Aug 2 13:05:30 2011
@@ -125,9 +125,11 @@
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;
}
}
More information about the cfe-commits
mailing list