From: Nico Weber Date: Mon, 8 Dec 2014 23:25:55 +0000 (+0000) Subject: Add a test for MS-ABI this adjustment for virtual calls to member operators. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40d9da6f4b90f2fb7dc469f8cb8efd21b57a207a;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223714 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp b/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp index 957980aa95..d71f40a5ec 100644 --- a/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp +++ b/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; +} + +}