Refine virtual base layout. WIP.

llvm-svn: 78873
This commit is contained in:
Mike Stump 2009-08-13 00:34:14 +00:00
parent 5fa97f021c
commit 6bb66bbd06
2 changed files with 13 additions and 1 deletions

View File

@ -173,7 +173,7 @@ void ASTRecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *RD) {
e = RD->vbases_end(); i != e; ++i) {
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
if (Base != PrimaryBase)
if (!PrimaryBaseWasVirtual || Base != PrimaryBase)
LayoutVirtualBase(Base);
}
}

View File

@ -92,6 +92,17 @@ int main() {
// CHECK-LP64: movl $2, 8(%rax)
struct test6_B2 { virtual void funcB2(); char b[1000]; };
struct test6_B1 : virtual test6_B2 { virtual void funcB1(); };
struct test6_D : test6_B2, virtual test6_B1 {
};
// CEHCK-LP32: .zerofill __DATA, __common, _d6, 2012, 4
// CHECK-LP64: .zerofill __DATA, __common, _d6, 2024, 4
struct test3_B3 { virtual void funcB3(); };
struct test3_B2 : virtual test3_B3 { virtual void funcB2(); };
struct test3_B1 : virtual test3_B2 { virtual void funcB1(); };
@ -370,6 +381,7 @@ struct test5_D : virtual test5_B1, virtual test5_B21, virtual test5_B31 {
// CHECK-LP64: .quad __ZN2D14bar5Ev
test6_D d6;
test5_D d5;
test4_D d4;
test3_D d3;