summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-12-08 23:25:55 +0000
committerNico Weber <nicolasweber@gmx.de>2014-12-08 23:25:55 +0000
commit02879eab94453007ea6d7355e74b818dd9bf3649 (patch)
treed3570a4ea5699baa17da4460a6cd98d628b91a10 /clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
parent0c10a85000074f1e8ac0fa88c853ede7b45818d4 (diff)
downloadbcm5719-llvm-02879eab94453007ea6d7355e74b818dd9bf3649.tar.gz
bcm5719-llvm-02879eab94453007ea6d7355e74b818dd9bf3649.zip
Add a test for MS-ABI this adjustment for virtual calls to member operators.
They too were fixed by r223185, despite the commit message saying otherwise. Add a test that makes sure they don't regress. llvm-svn: 223714
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp51
1 files changed, 45 insertions, 6 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp b/clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
index 957980aa95e..d71f40a5ecc 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o %t.ll -fdump-vtable-layouts >%t
// RUN: FileCheck %s < %t
-// RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
+// RUN: FileCheck --check-prefix=BITCODE %s < %t.ll
namespace test1 {
struct A {
@@ -29,8 +29,8 @@ struct X : A, B {
// CHECK-LABEL: VFTable indices for 'test1::X' (1 entry).
// CHECK-NEXT: 0 | void test1::X::g()
- // MANGLING-DAG: @"\01??_7X@test1@@6BA@1@@"
- // MANGLING-DAG: @"\01??_7X@test1@@6BB@1@@"
+ // BITCODE-DAG: @"\01??_7X@test1@@6BA@1@@"
+ // BITCODE-DAG: @"\01??_7X@test1@@6BB@1@@"
virtual void g();
} x;
@@ -71,9 +71,9 @@ struct X : A, B, C {
// CHECK-NEXT: via vfptr at offset 4
// CHECK-NEXT: 0 | void test2::X::g()
- // MANGLING-DAG: @"\01??_7X@test2@@6BA@1@@"
- // MANGLING-DAG: @"\01??_7X@test2@@6BB@1@@"
- // MANGLING-DAG: @"\01??_7X@test2@@6BC@1@@"
+ // BITCODE-DAG: @"\01??_7X@test2@@6BA@1@@"
+ // BITCODE-DAG: @"\01??_7X@test2@@6BB@1@@"
+ // BITCODE-DAG: @"\01??_7X@test2@@6BC@1@@"
virtual void g();
} x;
@@ -138,3 +138,42 @@ struct X: C, D {
void build_vftable(X *obj) { obj->g(); }
}
+
+namespace test4 {
+struct A {
+ virtual void foo();
+};
+struct B {
+ virtual int filler();
+ virtual int operator-();
+ virtual int bar();
+};
+struct C : public A, public B {
+ virtual int filler();
+ virtual int operator-();
+ virtual int bar();
+};
+
+// BITCODE-LABEL: define {{.*}}\01?ffun@test4@@YAXAAUC@1@@Z
+void ffun(C &c) {
+ // BITCODE: load
+ // BITCODE: bitcast
+ // BITCODE: bitcast
+ // BITCODE: [[THIS1:%.+]] = bitcast %"struct.test4::C"* {{.*}} to i8*
+ // BITCODE: [[THIS2:%.+]] = getelementptr inbounds i8* [[THIS1]], i32 4
+ // BITCODE-NEXT: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
+ c.bar();
+}
+
+// BITCODE-LABEL: define {{.*}}\01?fop@test4@@YAXAAUC@1@@Z
+void fop(C &c) {
+ // BITCODE: load
+ // BITCODE: bitcast
+ // BITCODE: bitcast
+ // BITCODE: [[THIS1:%.+]] = bitcast %"struct.test4::C"* {{.*}} to i8*
+ // BITCODE: [[THIS2:%.+]] = getelementptr inbounds i8* [[THIS1]], i32 4
+ // BITCODE-NEXT: call x86_thiscallcc {{.*}}(i8* [[THIS2]])
+ -c;
+}
+
+}
OpenPOWER on IntegriCloud