Correctly check for distructors when realizing vtordisps

This patch fixes the distructor test when checking for vtordisp requirements in 
microsoft record layout.  A test case is also included.

Addresses:
http://llvm.org/bugs/show_bug.cgi?id=16406#c7

llvm-svn: 192616
This commit is contained in:
Warren Hunt 2013-10-14 20:14:09 +00:00
parent a443563ff0
commit 42be77672a
2 changed files with 19 additions and 2 deletions

View File

@ -2989,7 +2989,7 @@ MicrosoftRecordLayoutBuilder::computeVtorDispSet(const CXXRecordDecl *RD) {
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
e = RD->method_end();
i != e; ++i)
if ((*i)->isVirtual() && (*i) != RD->getDestructor())
if ((*i)->isVirtual() && !isa<CXXDestructorDecl>(*i))
Work.insert(*i);
while (!Work.empty()) {
const CXXMethodDecl *MD = *Work.begin();

View File

@ -91,7 +91,24 @@ struct __declspec(align(32)) D : virtual B0, virtual B1 {
// CHECK: | [sizeof=96, align=32
// CHECK: | nvsize=12, nvalign=4]
struct AT {
virtual ~AT(){}
};
struct CT : virtual AT {
virtual ~CT();
};
CT::~CT(){}
// CHECK: *** Dumping AST Record Layout
// CHECK: 0 | struct CT
// CHECK: 0 | (CT vbtable pointer)
// CHECK: 4 | struct AT (virtual base)
// CHECK: 4 | (AT vftable pointer)
// CHECK: | [sizeof=8, align=4
// CHECK: | nvsize=4, nvalign=4]
int a[
sizeof(A)+
sizeof(C)+
sizeof(D)];
sizeof(D)+
sizeof(CT)];