]> granicus.if.org Git - clang/commitdiff
Add a previously-missing test case for return adjustment vs pure virtual methods
authorTimur Iskhodzhanov <timurrrr@google.com>
Fri, 12 Sep 2014 15:21:44 +0000 (15:21 +0000)
committerTimur Iskhodzhanov <timurrrr@google.com>
Fri, 12 Sep 2014 15:21:44 +0000 (15:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217686 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-return-adjustment.cpp

index 2f46609d097bff84c2ee48bfc12730c11e4ee800..232c0d9c4dd87fb4f0684cf53698f17d940f9c1a 100644 (file)
@@ -296,6 +296,30 @@ struct X : E {
 void build_vftable(X *obj) { obj->foo(); }
 }
 
+namespace test7 {
+struct A {
+  virtual A *f() = 0;
+};
+struct B {
+  virtual void g();
+};
+struct C : B, A {
+  virtual void g();
+  virtual C *f() = 0;
+  // CHECK-LABEL: VFTable for 'test7::B' in 'test7::C' (1 entry).
+  // CHECK-NEXT:   0 | void test7::C::g()
+
+  // CHECK-LABEL: VFTable for 'test7::A' in 'test7::C' (2 entries).
+  // CHECK-NEXT:   0 | test7::C *test7::C::f() [pure]
+  // CHECK-NEXT:   1 | test7::C *test7::C::f() [pure]
+
+  // No return adjusting thunks needed for pure virtual methods.
+  // CHECK-NOT: Thunks for 'test7::C *test7::C::f()'
+};
+
+void build_vftable(C *obj) { obj->g(); }
+}
+
 namespace pr20444 {
 struct A {
   virtual A* f();