1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts > %t 2>&1 2*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-1 %s < %t 3*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-2 %s < %t 4*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-3 %s < %t 5*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-4 %s < %t 6*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-5 %s < %t 7*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-6 %s < %t 8*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-7 %s < %t 9*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-8 %s < %t 10*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-9 %s < %t 11*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-10 %s < %t 12*f4a2713aSLionel Sambuc // RUN: FileCheck --check-prefix=CHECK-11 %s < %t 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc /// Examples from the Itanium C++ ABI specification. 15*f4a2713aSLionel Sambuc /// http://www.codesourcery.com/public/cxx-abi/ 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc namespace Test1 { 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc // This is from http://www.codesourcery.com/public/cxx-abi/cxx-vtable-ex.html 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc // CHECK-1: Vtable for 'Test1::A' (5 entries). 22*f4a2713aSLionel Sambuc // CHECK-1-NEXT: 0 | offset_to_top (0) 23*f4a2713aSLionel Sambuc // CHECK-1-NEXT: 1 | Test1::A RTTI 24*f4a2713aSLionel Sambuc // CHECK-1-NEXT: -- (Test1::A, 0) vtable address -- 25*f4a2713aSLionel Sambuc // CHECK-1-NEXT: 2 | void Test1::A::f() 26*f4a2713aSLionel Sambuc // CHECK-1-NEXT: 3 | void Test1::A::g() 27*f4a2713aSLionel Sambuc // CHECK-1-NEXT: 4 | void Test1::A::h() 28*f4a2713aSLionel Sambuc struct A { 29*f4a2713aSLionel Sambuc virtual void f (); 30*f4a2713aSLionel Sambuc virtual void g (); 31*f4a2713aSLionel Sambuc virtual void h (); 32*f4a2713aSLionel Sambuc int ia; 33*f4a2713aSLionel Sambuc }; 34*f4a2713aSLionel Sambuc void A::f() {} 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc // CHECK-2: Vtable for 'Test1::B' (13 entries). 37*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 0 | vbase_offset (16) 38*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 1 | offset_to_top (0) 39*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 2 | Test1::B RTTI 40*f4a2713aSLionel Sambuc // CHECK-2-NEXT: -- (Test1::B, 0) vtable address -- 41*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 3 | void Test1::B::f() 42*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 4 | void Test1::B::h() 43*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 5 | vcall_offset (-16) 44*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 6 | vcall_offset (0) 45*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 7 | vcall_offset (-16) 46*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 8 | offset_to_top (-16) 47*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 9 | Test1::B RTTI 48*f4a2713aSLionel Sambuc // CHECK-2-NEXT: -- (Test1::A, 16) vtable address -- 49*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 10 | void Test1::B::f() 50*f4a2713aSLionel Sambuc // CHECK-2-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 51*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 11 | void Test1::A::g() 52*f4a2713aSLionel Sambuc // CHECK-2-NEXT: 12 | void Test1::B::h() 53*f4a2713aSLionel Sambuc // CHECK-2-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] 54*f4a2713aSLionel Sambuc struct B: public virtual A { 55*f4a2713aSLionel Sambuc void f (); 56*f4a2713aSLionel Sambuc void h (); 57*f4a2713aSLionel Sambuc int ib; 58*f4a2713aSLionel Sambuc }; 59*f4a2713aSLionel Sambuc void B::f() {} 60*f4a2713aSLionel Sambuc 61*f4a2713aSLionel Sambuc // CHECK-3: Vtable for 'Test1::C' (13 entries). 62*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 0 | vbase_offset (16) 63*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 1 | offset_to_top (0) 64*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 2 | Test1::C RTTI 65*f4a2713aSLionel Sambuc // CHECK-3-NEXT: -- (Test1::C, 0) vtable address -- 66*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 3 | void Test1::C::g() 67*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 4 | void Test1::C::h() 68*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 5 | vcall_offset (-16) 69*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 6 | vcall_offset (-16) 70*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 7 | vcall_offset (0) 71*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 8 | offset_to_top (-16) 72*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 9 | Test1::C RTTI 73*f4a2713aSLionel Sambuc // CHECK-3-NEXT: -- (Test1::A, 16) vtable address -- 74*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 10 | void Test1::A::f() 75*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 11 | void Test1::C::g() 76*f4a2713aSLionel Sambuc // CHECK-3-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 77*f4a2713aSLionel Sambuc // CHECK-3-NEXT: 12 | void Test1::C::h() 78*f4a2713aSLionel Sambuc // CHECK-3-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] 79*f4a2713aSLionel Sambuc struct C: public virtual A { 80*f4a2713aSLionel Sambuc void g (); 81*f4a2713aSLionel Sambuc void h (); 82*f4a2713aSLionel Sambuc int ic; 83*f4a2713aSLionel Sambuc }; 84*f4a2713aSLionel Sambuc void C::g() {} 85*f4a2713aSLionel Sambuc 86*f4a2713aSLionel Sambuc // CHECK-4: Vtable for 'Test1::D' (18 entries). 87*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 0 | vbase_offset (32) 88*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 1 | offset_to_top (0) 89*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 2 | Test1::D RTTI 90*f4a2713aSLionel Sambuc // CHECK-4-NEXT: -- (Test1::B, 0) vtable address -- 91*f4a2713aSLionel Sambuc // CHECK-4-NEXT: -- (Test1::D, 0) vtable address -- 92*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 3 | void Test1::B::f() 93*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 4 | void Test1::D::h() 94*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 5 | vbase_offset (16) 95*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 6 | offset_to_top (-16) 96*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 7 | Test1::D RTTI 97*f4a2713aSLionel Sambuc // CHECK-4-NEXT: -- (Test1::C, 16) vtable address -- 98*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 8 | void Test1::C::g() 99*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 9 | void Test1::D::h() 100*f4a2713aSLionel Sambuc // CHECK-4-NEXT: [this adjustment: -16 non-virtual] 101*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 10 | vcall_offset (-32) 102*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 11 | vcall_offset (-16) 103*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 12 | vcall_offset (-32) 104*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 13 | offset_to_top (-32) 105*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 14 | Test1::D RTTI 106*f4a2713aSLionel Sambuc // CHECK-4-NEXT: -- (Test1::A, 32) vtable address -- 107*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 15 | void Test1::B::f() 108*f4a2713aSLionel Sambuc // CHECK-4-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 109*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 16 | void Test1::C::g() 110*f4a2713aSLionel Sambuc // CHECK-4-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 111*f4a2713aSLionel Sambuc // CHECK-4-NEXT: 17 | void Test1::D::h() 112*f4a2713aSLionel Sambuc // CHECK-4-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] 113*f4a2713aSLionel Sambuc struct D: public B, public C { 114*f4a2713aSLionel Sambuc void h (); 115*f4a2713aSLionel Sambuc int id; 116*f4a2713aSLionel Sambuc }; 117*f4a2713aSLionel Sambuc void D::h() { } 118*f4a2713aSLionel Sambuc 119*f4a2713aSLionel Sambuc struct X { 120*f4a2713aSLionel Sambuc int ix; 121*f4a2713aSLionel Sambuc virtual void x(); 122*f4a2713aSLionel Sambuc }; 123*f4a2713aSLionel Sambuc 124*f4a2713aSLionel Sambuc // CHECK-5: Vtable for 'Test1::E' (24 entries). 125*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 0 | vbase_offset (56) 126*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 1 | offset_to_top (0) 127*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 2 | Test1::E RTTI 128*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::E, 0) vtable address -- 129*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::X, 0) vtable address -- 130*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 3 | void Test1::X::x() 131*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 4 | void Test1::E::f() 132*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 5 | void Test1::E::h() 133*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 6 | vbase_offset (40) 134*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 7 | offset_to_top (-16) 135*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 8 | Test1::E RTTI 136*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::B, 16) vtable address -- 137*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::D, 16) vtable address -- 138*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 9 | void Test1::E::f() 139*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: -16 non-virtual] 140*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 10 | void Test1::E::h() 141*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: -16 non-virtual] 142*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 11 | vbase_offset (24) 143*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 12 | offset_to_top (-32) 144*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 13 | Test1::E RTTI 145*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::C, 32) vtable address -- 146*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 14 | void Test1::C::g() 147*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 15 | void Test1::E::h() 148*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: -32 non-virtual] 149*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 16 | vcall_offset (-56) 150*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 17 | vcall_offset (-24) 151*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 18 | vcall_offset (-56) 152*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 19 | offset_to_top (-56) 153*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 20 | Test1::E RTTI 154*f4a2713aSLionel Sambuc // CHECK-5-NEXT: -- (Test1::A, 56) vtable address -- 155*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 21 | void Test1::E::f() 156*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 157*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 22 | void Test1::C::g() 158*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 159*f4a2713aSLionel Sambuc // CHECK-5-NEXT: 23 | void Test1::E::h() 160*f4a2713aSLionel Sambuc // CHECK-5-NEXT: [this adjustment: 0 non-virtual, -40 vcall offset offset] 161*f4a2713aSLionel Sambuc struct E : X, D { 162*f4a2713aSLionel Sambuc int ie; 163*f4a2713aSLionel Sambuc void f(); 164*f4a2713aSLionel Sambuc void h (); 165*f4a2713aSLionel Sambuc }; 166*f4a2713aSLionel Sambuc void E::f() { } 167*f4a2713aSLionel Sambuc 168*f4a2713aSLionel Sambuc } 169*f4a2713aSLionel Sambuc 170*f4a2713aSLionel Sambuc namespace Test2 { 171*f4a2713aSLionel Sambuc 172*f4a2713aSLionel Sambuc // From http://www.codesourcery.com/public/cxx-abi/abi.html#class-types. 173*f4a2713aSLionel Sambuc 174*f4a2713aSLionel Sambuc struct A { virtual void f(); }; 175*f4a2713aSLionel Sambuc struct B : virtual public A { int i; }; 176*f4a2713aSLionel Sambuc struct C : virtual public A { int j; }; 177*f4a2713aSLionel Sambuc 178*f4a2713aSLionel Sambuc // CHECK-6: Vtable for 'Test2::D' (11 entries). 179*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 0 | vbase_offset (0) 180*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 1 | vcall_offset (0) 181*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 2 | offset_to_top (0) 182*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 3 | Test2::D RTTI 183*f4a2713aSLionel Sambuc // CHECK-6-NEXT: -- (Test2::A, 0) vtable address -- 184*f4a2713aSLionel Sambuc // CHECK-6-NEXT: -- (Test2::B, 0) vtable address -- 185*f4a2713aSLionel Sambuc // CHECK-6-NEXT: -- (Test2::D, 0) vtable address -- 186*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 4 | void Test2::A::f() 187*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 5 | void Test2::D::d() 188*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 6 | vbase_offset (-16) 189*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 7 | vcall_offset (-16) 190*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 8 | offset_to_top (-16) 191*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 9 | Test2::D RTTI 192*f4a2713aSLionel Sambuc // CHECK-6-NEXT: -- (Test2::C, 16) vtable address -- 193*f4a2713aSLionel Sambuc // CHECK-6-NEXT: 10 | [unused] void Test2::A::f() 194*f4a2713aSLionel Sambuc struct D : public B, public C { 195*f4a2713aSLionel Sambuc virtual void d(); 196*f4a2713aSLionel Sambuc }; 197*f4a2713aSLionel Sambuc void D::d() { } 198*f4a2713aSLionel Sambuc 199*f4a2713aSLionel Sambuc } 200*f4a2713aSLionel Sambuc 201*f4a2713aSLionel Sambuc namespace Test3 { 202*f4a2713aSLionel Sambuc 203*f4a2713aSLionel Sambuc // From http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor 204*f4a2713aSLionel Sambuc 205*f4a2713aSLionel Sambuc struct V1 { 206*f4a2713aSLionel Sambuc int v1; 207*f4a2713aSLionel Sambuc virtual void f(); 208*f4a2713aSLionel Sambuc }; 209*f4a2713aSLionel Sambuc 210*f4a2713aSLionel Sambuc struct V2 : virtual V1 { 211*f4a2713aSLionel Sambuc int v2; 212*f4a2713aSLionel Sambuc virtual void f(); 213*f4a2713aSLionel Sambuc }; 214*f4a2713aSLionel Sambuc 215*f4a2713aSLionel Sambuc // CHECK-7: Vtable for 'Test3::C' (14 entries). 216*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 0 | vbase_offset (32) 217*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 1 | vbase_offset (16) 218*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 2 | offset_to_top (0) 219*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 3 | Test3::C RTTI 220*f4a2713aSLionel Sambuc // CHECK-7-NEXT: -- (Test3::C, 0) vtable address -- 221*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 4 | void Test3::C::f() 222*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 5 | vcall_offset (-16) 223*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 6 | offset_to_top (-16) 224*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 7 | Test3::C RTTI 225*f4a2713aSLionel Sambuc // CHECK-7-NEXT: -- (Test3::V1, 16) vtable address -- 226*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 8 | void Test3::C::f() 227*f4a2713aSLionel Sambuc // CHECK-7-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 228*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 9 | vcall_offset (-32) 229*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 10 | vbase_offset (-16) 230*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 11 | offset_to_top (-32) 231*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 12 | Test3::C RTTI 232*f4a2713aSLionel Sambuc // CHECK-7-NEXT: -- (Test3::V2, 32) vtable address -- 233*f4a2713aSLionel Sambuc // CHECK-7-NEXT: 13 | void Test3::C::f() 234*f4a2713aSLionel Sambuc // CHECK-7-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 235*f4a2713aSLionel Sambuc 236*f4a2713aSLionel Sambuc // CHECK-8: Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries). 237*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 0 | vcall_offset (0) 238*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 1 | vbase_offset (-16) 239*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 2 | offset_to_top (0) 240*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 3 | Test3::V2 RTTI 241*f4a2713aSLionel Sambuc // CHECK-8-NEXT: -- (Test3::V2, 32) vtable address -- 242*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 4 | void Test3::V2::f() 243*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 5 | vcall_offset (16) 244*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 6 | offset_to_top (16) 245*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 7 | Test3::V2 RTTI 246*f4a2713aSLionel Sambuc // CHECK-8-NEXT: -- (Test3::V1, 16) vtable address -- 247*f4a2713aSLionel Sambuc // CHECK-8-NEXT: 8 | void Test3::V2::f() 248*f4a2713aSLionel Sambuc // CHECK-8-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 249*f4a2713aSLionel Sambuc struct C : virtual V1, virtual V2 { 250*f4a2713aSLionel Sambuc int c; 251*f4a2713aSLionel Sambuc virtual void f(); 252*f4a2713aSLionel Sambuc }; 253*f4a2713aSLionel Sambuc void C::f() { } 254*f4a2713aSLionel Sambuc 255*f4a2713aSLionel Sambuc struct B { 256*f4a2713aSLionel Sambuc int b; 257*f4a2713aSLionel Sambuc }; 258*f4a2713aSLionel Sambuc 259*f4a2713aSLionel Sambuc // CHECK-9: Vtable for 'Test3::D' (15 entries). 260*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 0 | vbase_offset (40) 261*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 1 | vbase_offset (24) 262*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 2 | offset_to_top (0) 263*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 3 | Test3::D RTTI 264*f4a2713aSLionel Sambuc // CHECK-9-NEXT: -- (Test3::C, 0) vtable address -- 265*f4a2713aSLionel Sambuc // CHECK-9-NEXT: -- (Test3::D, 0) vtable address -- 266*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 4 | void Test3::C::f() 267*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 5 | void Test3::D::g() 268*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 6 | vcall_offset (-24) 269*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 7 | offset_to_top (-24) 270*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 8 | Test3::D RTTI 271*f4a2713aSLionel Sambuc // CHECK-9-NEXT: -- (Test3::V1, 24) vtable address -- 272*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 9 | void Test3::C::f() 273*f4a2713aSLionel Sambuc // CHECK-9-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 274*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 10 | vcall_offset (-40) 275*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 11 | vbase_offset (-16) 276*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 12 | offset_to_top (-40) 277*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 13 | Test3::D RTTI 278*f4a2713aSLionel Sambuc // CHECK-9-NEXT: -- (Test3::V2, 40) vtable address -- 279*f4a2713aSLionel Sambuc // CHECK-9-NEXT: 14 | void Test3::C::f() 280*f4a2713aSLionel Sambuc // CHECK-9-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 281*f4a2713aSLionel Sambuc 282*f4a2713aSLionel Sambuc // CHECK-10: Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries). 283*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 0 | vbase_offset (40) 284*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 1 | vbase_offset (24) 285*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 2 | offset_to_top (0) 286*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 3 | Test3::C RTTI 287*f4a2713aSLionel Sambuc // CHECK-10-NEXT: -- (Test3::C, 0) vtable address -- 288*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 4 | void Test3::C::f() 289*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 5 | vcall_offset (-24) 290*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 6 | offset_to_top (-24) 291*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 7 | Test3::C RTTI 292*f4a2713aSLionel Sambuc // CHECK-10-NEXT: -- (Test3::V1, 24) vtable address -- 293*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 8 | void Test3::C::f() 294*f4a2713aSLionel Sambuc // CHECK-10-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 295*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 9 | vcall_offset (-40) 296*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 10 | vbase_offset (-16) 297*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 11 | offset_to_top (-40) 298*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 12 | Test3::C RTTI 299*f4a2713aSLionel Sambuc // CHECK-10-NEXT: -- (Test3::V2, 40) vtable address -- 300*f4a2713aSLionel Sambuc // CHECK-10-NEXT: 13 | void Test3::C::f() 301*f4a2713aSLionel Sambuc // CHECK-10-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] 302*f4a2713aSLionel Sambuc 303*f4a2713aSLionel Sambuc // CHECK-11: Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries). 304*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 0 | vcall_offset (0) 305*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 1 | vbase_offset (-16) 306*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 2 | offset_to_top (0) 307*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 3 | Test3::V2 RTTI 308*f4a2713aSLionel Sambuc // CHECK-11-NEXT: -- (Test3::V2, 40) vtable address -- 309*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 4 | void Test3::V2::f() 310*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 5 | vcall_offset (16) 311*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 6 | offset_to_top (16) 312*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 7 | Test3::V2 RTTI 313*f4a2713aSLionel Sambuc // CHECK-11-NEXT: -- (Test3::V1, 24) vtable address -- 314*f4a2713aSLionel Sambuc // CHECK-11-NEXT: 8 | void Test3::V2::f() 315*f4a2713aSLionel Sambuc // CHECK-11-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] 316*f4a2713aSLionel Sambuc struct D : B, C { 317*f4a2713aSLionel Sambuc int d; 318*f4a2713aSLionel Sambuc virtual void g(); 319*f4a2713aSLionel Sambuc }; 320*f4a2713aSLionel Sambuc void D::g() { } 321*f4a2713aSLionel Sambuc 322*f4a2713aSLionel Sambuc } 323