forked from OSchip/llvm-project
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:
parent
a443563ff0
commit
42be77672a
|
@ -2989,7 +2989,7 @@ MicrosoftRecordLayoutBuilder::computeVtorDispSet(const CXXRecordDecl *RD) {
|
||||||
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
|
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
|
||||||
e = RD->method_end();
|
e = RD->method_end();
|
||||||
i != e; ++i)
|
i != e; ++i)
|
||||||
if ((*i)->isVirtual() && (*i) != RD->getDestructor())
|
if ((*i)->isVirtual() && !isa<CXXDestructorDecl>(*i))
|
||||||
Work.insert(*i);
|
Work.insert(*i);
|
||||||
while (!Work.empty()) {
|
while (!Work.empty()) {
|
||||||
const CXXMethodDecl *MD = *Work.begin();
|
const CXXMethodDecl *MD = *Work.begin();
|
||||||
|
|
|
@ -91,7 +91,24 @@ struct __declspec(align(32)) D : virtual B0, virtual B1 {
|
||||||
// CHECK: | [sizeof=96, align=32
|
// CHECK: | [sizeof=96, align=32
|
||||||
// CHECK: | nvsize=12, nvalign=4]
|
// 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[
|
int a[
|
||||||
sizeof(A)+
|
sizeof(A)+
|
||||||
sizeof(C)+
|
sizeof(C)+
|
||||||
sizeof(D)];
|
sizeof(D)+
|
||||||
|
sizeof(CT)];
|
||||||
|
|
Loading…
Reference in New Issue