summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-09-22 23:14:46 +0000
committerReid Kleckner <reid@kleckner.net>2014-09-22 23:14:46 +0000
commit15fdcf19ba2ede743600729010756a7480015d9c (patch)
tree96bd440a2348f03308df2c0837815e5af856ddb2 /clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
parent4bc685c206684e64919221ecb9ce4a13802649be (diff)
downloadbcm5719-llvm-15fdcf19ba2ede743600729010756a7480015d9c.tar.gz
bcm5719-llvm-15fdcf19ba2ede743600729010756a7480015d9c.zip
Fix a vftable mangling bug
We need to walk the class hierarchy twice: once in depth-first base specifier order for mangling and again in depth-first layout order for vftable layout. Vftable layout seems to depend on the full path from the most derived class to the base containing the vfptr. Fixes PR21031. llvm-svn: 218285
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp b/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
index 2e4a056316c..23129a3e228 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
@@ -573,10 +573,6 @@ struct Q {
// PR19172: Yet another diamond we miscompiled.
struct R : virtual Q, X {
- // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::R' (2 entries).
- // CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
- // CHECK-NEXT: 1 | void vdtors::X::zzz()
-
// CHECK-LABEL: VFTable for 'vdtors::Q' in 'vdtors::R' (1 entry).
// CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
// CHECK-NEXT: [this adjustment: -8 non-virtual]
@@ -584,6 +580,10 @@ struct R : virtual Q, X {
// CHECK-LABEL: Thunks for 'vdtors::R::~R()' (1 entry).
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
+ // CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::R' (2 entries).
+ // CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
+ // CHECK-NEXT: 1 | void vdtors::X::zzz()
+
// CHECK-LABEL: VFTable indices for 'vdtors::R' (1 entry).
// CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
virtual ~R();
@@ -694,10 +694,10 @@ struct X : virtual B {};
struct Y : virtual X, B {
Y();
- // CHECK-LABEL: VFTable for 'B' in 'pr19066::Y' (1 entry).
+ // CHECK-LABEL: VFTable for 'B' in 'pr19066::X' in 'pr19066::Y' (1 entry).
// CHECK-NEXT: 0 | void B::g()
- // CHECK-LABEL: VFTable for 'B' in 'pr19066::X' in 'pr19066::Y' (1 entry).
+ // CHECK-LABEL: VFTable for 'B' in 'pr19066::Y' (1 entry).
// CHECK-NEXT: 0 | void B::g()
};
@@ -772,3 +772,36 @@ struct __declspec(dllexport) A {
virtual void f() = delete;
};
}
+
+namespace pr21031_1 {
+// This ordering of base specifiers regressed in r202425.
+struct A { virtual void f(void); };
+struct B : virtual A { virtual void g(void); };
+struct C : virtual A, B { C(); };
+C::C() {}
+
+// CHECK-LABEL: VFTable for 'pr21031_1::A' in 'pr21031_1::B' in 'pr21031_1::C' (1 entry)
+// CHECK-NEXT: 0 | void pr21031_1::A::f()
+
+// CHECK-LABEL: VFTable for 'pr21031_1::B' in 'pr21031_1::C' (1 entry)
+// CHECK-NEXT: 0 | void pr21031_1::B::g()
+
+// MANGLING-DAG: @"\01??_7C@pr21031_1@@6BB@1@@" = {{.*}} constant [1 x i8*]
+// MANGLING-DAG: @"\01??_7C@pr21031_1@@6B@" = {{.*}} constant [1 x i8*]
+}
+
+namespace pr21031_2 {
+struct A { virtual void f(void); };
+struct B : virtual A { virtual void g(void); };
+struct C : B, virtual A { C(); };
+C::C() {}
+
+// CHECK-LABEL: VFTable for 'pr21031_2::B' in 'pr21031_2::C' (1 entry)
+// CHECK-NEXT: 0 | void pr21031_2::B::g()
+
+// CHECK-LABEL: VFTable for 'pr21031_2::A' in 'pr21031_2::B' in 'pr21031_2::C' (1 entry)
+// CHECK-NEXT: 0 | void pr21031_2::A::f()
+
+// MANGLING-DAG: @"\01??_7C@pr21031_2@@6BA@1@@" = {{.*}} constant [1 x i8*]
+// MANGLING-DAG: @"\01??_7C@pr21031_2@@6BB@1@@" = {{.*}} constant [1 x i8*]
+}
OpenPOWER on IntegriCloud