summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-08-09 17:08:06 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-08-09 17:08:06 +0000
commitf97c973c2e40400531663a2020e6c3514baaf7b2 (patch)
tree2c02e2f0df40e390f5d9188ff28b75488c5ae0be /clang/test
parent9cf3625742dd8c1ed38e74ca01101dbaaac4e7cf (diff)
downloadbcm5719-llvm-f97c973c2e40400531663a2020e6c3514baaf7b2.tar.gz
bcm5719-llvm-f97c973c2e40400531663a2020e6c3514baaf7b2.zip
Fix PR20479 -- missing vftable slots in case of virtual inheritance vs return adjusting thunks
Reviewed at http://reviews.llvm.org/D4829 llvm-svn: 215285
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp24
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp12
2 files changed, 30 insertions, 6 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp b/clang/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp
index a4a21106c68..072cb956035 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-vtables-return-thunks.cpp
@@ -104,3 +104,27 @@ K::K() {}
// GLOBALS-LABEL: @"\01??_7K@test2@@6B@" = linkonce_odr unnamed_addr constant [3 x i8*]
}
+
+namespace pr20479 {
+struct A {
+ virtual A *f();
+};
+
+struct B : virtual A {
+ virtual B *f();
+};
+
+struct C : virtual A, B {
+// VFTABLES-LABEL: VFTable for 'pr20479::A' in 'pr20479::B' in 'pr20479::C' (2 entries).
+// VFTABLES-NEXT: 0 | pr20479::B *pr20479::B::f()
+// VFTABLES-NEXT: [return adjustment (to type 'struct pr20479::A *'): vbase #1, 0 non-virtual]
+// VFTABLES-NEXT: 1 | pr20479::B *pr20479::B::f()
+ C();
+};
+
+C::C() {}
+
+// GLOBALS-LABEL: @"\01??_7C@pr20479@@6B@" = linkonce_odr unnamed_addr constant [2 x i8*]
+// GLOBALS: @"\01?f@B@pr20479@@QAEPAUA@2@XZ"
+// GLOBALS: @"\01?f@B@pr20479@@UAEPAU12@XZ"
+}
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp b/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
index 4ce4e9c2e17..5f0c5050c03 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
@@ -573,6 +573,10 @@ 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]
@@ -580,10 +584,6 @@ 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::X' in 'pr19066::Y' (1 entry).
+ // CHECK-LABEL: VFTable for 'B' in 'pr19066::Y' (1 entry).
// CHECK-NEXT: 0 | void B::g()
- // 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()
};
OpenPOWER on IntegriCloud