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