r223714 - Add a test for MS-ABI this adjustment for virtual calls to member operators.

Nico Weber nicolasweber at gmx.de
Mon Dec 8 15:25:56 PST 2014


Author: nico
Date: Mon Dec  8 17:25:55 2014
New Revision: 223714

URL: http://llvm.org/viewvc/llvm-project?rev=223714&view=rev
Log:
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.

Modified:
    cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp?rev=223714&r1=223713&r2=223714&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp Mon Dec  8 17:25:55 2014
@@ -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 at test1@@6BA at 1@@"
-  // MANGLING-DAG: @"\01??_7X at test1@@6BB at 1@@"
+  // BITCODE-DAG: @"\01??_7X at test1@@6BA at 1@@"
+  // BITCODE-DAG: @"\01??_7X at test1@@6BB at 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 at test2@@6BA at 1@@"
-  // MANGLING-DAG: @"\01??_7X at test2@@6BB at 1@@"
-  // MANGLING-DAG: @"\01??_7X at test2@@6BC at 1@@"
+  // BITCODE-DAG: @"\01??_7X at test2@@6BA at 1@@"
+  // BITCODE-DAG: @"\01??_7X at test2@@6BB at 1@@"
+  // BITCODE-DAG: @"\01??_7X at test2@@6BC at 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 at test4@@YAXAAUC at 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 at test4@@YAXAAUC at 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;
+}
+
+}





More information about the cfe-commits mailing list