1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -fno-rtti -triple=i386-pc-win32 -emit-llvm -o %t.ll -fdump-vtable-layouts >%t 2*0a6a1f1dSLionel Sambuc // RUN: FileCheck %s < %t 3*0a6a1f1dSLionel Sambuc // RUN: FileCheck --check-prefix=MANGLING %s < %t.ll 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel Sambuc struct A { 6*0a6a1f1dSLionel Sambuc virtual void f(); 7*0a6a1f1dSLionel Sambuc }; 8*0a6a1f1dSLionel Sambuc 9*0a6a1f1dSLionel Sambuc struct B { 10*0a6a1f1dSLionel Sambuc virtual void g() = 0; 11*0a6a1f1dSLionel Sambuc virtual void h(); 12*0a6a1f1dSLionel Sambuc }; 13*0a6a1f1dSLionel Sambuc 14*0a6a1f1dSLionel Sambuc struct C : A, B { 15*0a6a1f1dSLionel Sambuc // CHECK-LABEL: VFTable for 'A' in 'C' (1 entry) 16*0a6a1f1dSLionel Sambuc // CHECK-NEXT: 0 | void A::f() 17*0a6a1f1dSLionel Sambuc 18*0a6a1f1dSLionel Sambuc // CHECK-LABEL: VFTable for 'B' in 'C' (2 entries) 19*0a6a1f1dSLionel Sambuc // CHECK-NEXT: 0 | void C::g() 20*0a6a1f1dSLionel Sambuc // CHECK-NEXT: 1 | void B::h() 21*0a6a1f1dSLionel Sambuc 22*0a6a1f1dSLionel Sambuc // CHECK-LABEL: VFTable indices for 'C' (1 entry). 23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: via vfptr at offset 4 24*0a6a1f1dSLionel Sambuc // CHECK-NEXT: 0 | void C::g() 25*0a6a1f1dSLionel Sambuc 26*0a6a1f1dSLionel Sambuc // MANGLING-DAG: @"\01??_7C@@6BA@@@" 27*0a6a1f1dSLionel Sambuc // MANGLING-DAG: @"\01??_7C@@6BB@@@" 28*0a6a1f1dSLionel Sambuc 29*0a6a1f1dSLionel Sambuc // Overrides only the right child's method (B::g), 30*0a6a1f1dSLionel Sambuc // needs this adjustment but not thunks. 31*0a6a1f1dSLionel Sambuc virtual void g(); 32*0a6a1f1dSLionel Sambuc }; 33*0a6a1f1dSLionel Sambuc 34*0a6a1f1dSLionel Sambuc C c; build_vftable(C * obj)35*0a6a1f1dSLionel Sambucvoid build_vftable(C *obj) { obj->g(); } 36