xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/vtable-layout-extreme.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts 2>&1 | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // A collection of big class hierarchies and their vtables.
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc namespace Test1 {
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc class C0
8*f4a2713aSLionel Sambuc {
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc class C1
11*f4a2713aSLionel Sambuc  :  virtual public C0
12*f4a2713aSLionel Sambuc {
13*f4a2713aSLionel Sambuc   int k0;
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc class C2
16*f4a2713aSLionel Sambuc  :  public C0
17*f4a2713aSLionel Sambuc  ,  virtual public C1
18*f4a2713aSLionel Sambuc {
19*f4a2713aSLionel Sambuc   int k0;
20*f4a2713aSLionel Sambuc };
21*f4a2713aSLionel Sambuc class C3
22*f4a2713aSLionel Sambuc  :  virtual public C0
23*f4a2713aSLionel Sambuc  ,  virtual public C1
24*f4a2713aSLionel Sambuc  ,  public C2
25*f4a2713aSLionel Sambuc {
26*f4a2713aSLionel Sambuc   int k0;
27*f4a2713aSLionel Sambuc   int k1;
28*f4a2713aSLionel Sambuc   int k2;
29*f4a2713aSLionel Sambuc   int k3;
30*f4a2713aSLionel Sambuc };
31*f4a2713aSLionel Sambuc class C4
32*f4a2713aSLionel Sambuc  :  public C2
33*f4a2713aSLionel Sambuc  ,  virtual public C3
34*f4a2713aSLionel Sambuc  ,  public C0
35*f4a2713aSLionel Sambuc {
36*f4a2713aSLionel Sambuc   int k0;
37*f4a2713aSLionel Sambuc };
38*f4a2713aSLionel Sambuc class C5
39*f4a2713aSLionel Sambuc  :  public C0
40*f4a2713aSLionel Sambuc  ,  virtual public C4
41*f4a2713aSLionel Sambuc  ,  public C2
42*f4a2713aSLionel Sambuc  ,  public C1
43*f4a2713aSLionel Sambuc  ,  virtual public C3
44*f4a2713aSLionel Sambuc {
45*f4a2713aSLionel Sambuc   int k0;
46*f4a2713aSLionel Sambuc };
47*f4a2713aSLionel Sambuc class C6
48*f4a2713aSLionel Sambuc  :  virtual public C3
49*f4a2713aSLionel Sambuc  ,  public C0
50*f4a2713aSLionel Sambuc  ,  public C5
51*f4a2713aSLionel Sambuc  ,  public C4
52*f4a2713aSLionel Sambuc  ,  public C1
53*f4a2713aSLionel Sambuc {
54*f4a2713aSLionel Sambuc   int k0;
55*f4a2713aSLionel Sambuc };
56*f4a2713aSLionel Sambuc class C7
57*f4a2713aSLionel Sambuc  :  virtual public C5
58*f4a2713aSLionel Sambuc  ,  virtual public C6
59*f4a2713aSLionel Sambuc  ,  virtual public C3
60*f4a2713aSLionel Sambuc  ,  public C4
61*f4a2713aSLionel Sambuc  ,  virtual public C2
62*f4a2713aSLionel Sambuc {
63*f4a2713aSLionel Sambuc   int k0;
64*f4a2713aSLionel Sambuc   int k1;
65*f4a2713aSLionel Sambuc };
66*f4a2713aSLionel Sambuc class C8
67*f4a2713aSLionel Sambuc  :  public C7
68*f4a2713aSLionel Sambuc  ,  public C5
69*f4a2713aSLionel Sambuc  ,  public C3
70*f4a2713aSLionel Sambuc  ,  virtual public C4
71*f4a2713aSLionel Sambuc  ,  public C1
72*f4a2713aSLionel Sambuc  ,  public C2
73*f4a2713aSLionel Sambuc {
74*f4a2713aSLionel Sambuc   int k0;
75*f4a2713aSLionel Sambuc   int k1;
76*f4a2713aSLionel Sambuc };
77*f4a2713aSLionel Sambuc 
78*f4a2713aSLionel Sambuc // CHECK:     Vtable for 'Test1::C9' (87 entries).
79*f4a2713aSLionel Sambuc // CHECK-NEXT:   0 | vbase_offset (344)
80*f4a2713aSLionel Sambuc // CHECK-NEXT:   1 | vbase_offset (312)
81*f4a2713aSLionel Sambuc // CHECK-NEXT:   2 | vbase_offset (184)
82*f4a2713aSLionel Sambuc // CHECK-NEXT:   3 | vbase_offset (168)
83*f4a2713aSLionel Sambuc // CHECK-NEXT:   4 | vbase_offset (120)
84*f4a2713aSLionel Sambuc // CHECK-NEXT:   5 | vbase_offset (48)
85*f4a2713aSLionel Sambuc // CHECK-NEXT:   6 | vbase_offset (148)
86*f4a2713aSLionel Sambuc // CHECK-NEXT:   7 | vbase_offset (152)
87*f4a2713aSLionel Sambuc // CHECK-NEXT:   8 | offset_to_top (0)
88*f4a2713aSLionel Sambuc // CHECK-NEXT:   9 | Test1::C9 RTTI
89*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 0) vtable address --
90*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C9, 0) vtable address --
91*f4a2713aSLionel Sambuc // CHECK-NEXT:  10 | void Test1::C9::f()
92*f4a2713aSLionel Sambuc // CHECK-NEXT:  11 | vbase_offset (104)
93*f4a2713aSLionel Sambuc // CHECK-NEXT:  12 | vbase_offset (132)
94*f4a2713aSLionel Sambuc // CHECK-NEXT:  13 | vbase_offset (136)
95*f4a2713aSLionel Sambuc // CHECK-NEXT:  14 | offset_to_top (-16)
96*f4a2713aSLionel Sambuc // CHECK-NEXT:  15 | Test1::C9 RTTI
97*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 16) vtable address --
98*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C4, 16) vtable address --
99*f4a2713aSLionel Sambuc // CHECK-NEXT:  16 | vbase_offset (72)
100*f4a2713aSLionel Sambuc // CHECK-NEXT:  17 | vbase_offset (120)
101*f4a2713aSLionel Sambuc // CHECK-NEXT:  18 | vbase_offset (100)
102*f4a2713aSLionel Sambuc // CHECK-NEXT:  19 | vbase_offset (104)
103*f4a2713aSLionel Sambuc // CHECK-NEXT:  20 | offset_to_top (-48)
104*f4a2713aSLionel Sambuc // CHECK-NEXT:  21 | Test1::C9 RTTI
105*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 48) vtable address --
106*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C5, 48) vtable address --
107*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C6, 48) vtable address --
108*f4a2713aSLionel Sambuc // CHECK-NEXT:  22 | vbase_offset (84)
109*f4a2713aSLionel Sambuc // CHECK-NEXT:  23 | offset_to_top (-64)
110*f4a2713aSLionel Sambuc // CHECK-NEXT:  24 | Test1::C9 RTTI
111*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 64) vtable address --
112*f4a2713aSLionel Sambuc // CHECK-NEXT:  25 | vbase_offset (32)
113*f4a2713aSLionel Sambuc // CHECK-NEXT:  26 | vbase_offset (60)
114*f4a2713aSLionel Sambuc // CHECK-NEXT:  27 | vbase_offset (64)
115*f4a2713aSLionel Sambuc // CHECK-NEXT:  28 | offset_to_top (-88)
116*f4a2713aSLionel Sambuc // CHECK-NEXT:  29 | Test1::C9 RTTI
117*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 88) vtable address --
118*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C4, 88) vtable address --
119*f4a2713aSLionel Sambuc // CHECK-NEXT:  30 | vbase_offset (44)
120*f4a2713aSLionel Sambuc // CHECK-NEXT:  31 | offset_to_top (-104)
121*f4a2713aSLionel Sambuc // CHECK-NEXT:  32 | Test1::C9 RTTI
122*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 104) vtable address --
123*f4a2713aSLionel Sambuc // CHECK-NEXT:  33 | vbase_offset (28)
124*f4a2713aSLionel Sambuc // CHECK-NEXT:  34 | vbase_offset (32)
125*f4a2713aSLionel Sambuc // CHECK-NEXT:  35 | offset_to_top (-120)
126*f4a2713aSLionel Sambuc // CHECK-NEXT:  36 | Test1::C9 RTTI
127*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 120) vtable address --
128*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C3, 120) vtable address --
129*f4a2713aSLionel Sambuc // CHECK-NEXT:  37 | vbase_offset (-4)
130*f4a2713aSLionel Sambuc // CHECK-NEXT:  38 | offset_to_top (-152)
131*f4a2713aSLionel Sambuc // CHECK-NEXT:  39 | Test1::C9 RTTI
132*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 152) vtable address --
133*f4a2713aSLionel Sambuc // CHECK-NEXT:  40 | vbase_offset (-48)
134*f4a2713aSLionel Sambuc // CHECK-NEXT:  41 | vbase_offset (-20)
135*f4a2713aSLionel Sambuc // CHECK-NEXT:  42 | vbase_offset (-16)
136*f4a2713aSLionel Sambuc // CHECK-NEXT:  43 | offset_to_top (-168)
137*f4a2713aSLionel Sambuc // CHECK-NEXT:  44 | Test1::C9 RTTI
138*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 168) vtable address --
139*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C4, 168) vtable address --
140*f4a2713aSLionel Sambuc // CHECK-NEXT:  45 | vbase_offset (160)
141*f4a2713aSLionel Sambuc // CHECK-NEXT:  46 | vbase_offset (-136)
142*f4a2713aSLionel Sambuc // CHECK-NEXT:  47 | vbase_offset (-16)
143*f4a2713aSLionel Sambuc // CHECK-NEXT:  48 | vbase_offset (128)
144*f4a2713aSLionel Sambuc // CHECK-NEXT:  49 | vbase_offset (-64)
145*f4a2713aSLionel Sambuc // CHECK-NEXT:  50 | vbase_offset (-36)
146*f4a2713aSLionel Sambuc // CHECK-NEXT:  51 | vbase_offset (-32)
147*f4a2713aSLionel Sambuc // CHECK-NEXT:  52 | offset_to_top (-184)
148*f4a2713aSLionel Sambuc // CHECK-NEXT:  53 | Test1::C9 RTTI
149*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 184) vtable address --
150*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C4, 184) vtable address --
151*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C7, 184) vtable address --
152*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C8, 184) vtable address --
153*f4a2713aSLionel Sambuc // CHECK-NEXT:  54 | vbase_offset (-88)
154*f4a2713aSLionel Sambuc // CHECK-NEXT:  55 | vbase_offset (-40)
155*f4a2713aSLionel Sambuc // CHECK-NEXT:  56 | vbase_offset (-60)
156*f4a2713aSLionel Sambuc // CHECK-NEXT:  57 | vbase_offset (-56)
157*f4a2713aSLionel Sambuc // CHECK-NEXT:  58 | offset_to_top (-208)
158*f4a2713aSLionel Sambuc // CHECK-NEXT:  59 | Test1::C9 RTTI
159*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 208) vtable address --
160*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C5, 208) vtable address --
161*f4a2713aSLionel Sambuc // CHECK-NEXT:  60 | vbase_offset (-76)
162*f4a2713aSLionel Sambuc // CHECK-NEXT:  61 | offset_to_top (-224)
163*f4a2713aSLionel Sambuc // CHECK-NEXT:  62 | Test1::C9 RTTI
164*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 224) vtable address --
165*f4a2713aSLionel Sambuc // CHECK-NEXT:  63 | vbase_offset (-92)
166*f4a2713aSLionel Sambuc // CHECK-NEXT:  64 | vbase_offset (-88)
167*f4a2713aSLionel Sambuc // CHECK-NEXT:  65 | offset_to_top (-240)
168*f4a2713aSLionel Sambuc // CHECK-NEXT:  66 | Test1::C9 RTTI
169*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 240) vtable address --
170*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C3, 240) vtable address --
171*f4a2713aSLionel Sambuc // CHECK-NEXT:  67 | vbase_offset (-124)
172*f4a2713aSLionel Sambuc // CHECK-NEXT:  68 | offset_to_top (-272)
173*f4a2713aSLionel Sambuc // CHECK-NEXT:  69 | Test1::C9 RTTI
174*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 272) vtable address --
175*f4a2713aSLionel Sambuc // CHECK-NEXT:  70 | vbase_offset (-140)
176*f4a2713aSLionel Sambuc // CHECK-NEXT:  71 | vbase_offset (-136)
177*f4a2713aSLionel Sambuc // CHECK-NEXT:  72 | offset_to_top (-288)
178*f4a2713aSLionel Sambuc // CHECK-NEXT:  73 | Test1::C9 RTTI
179*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 288) vtable address --
180*f4a2713aSLionel Sambuc // CHECK-NEXT:  74 | vbase_offset (-192)
181*f4a2713aSLionel Sambuc // CHECK-NEXT:  75 | vbase_offset (-144)
182*f4a2713aSLionel Sambuc // CHECK-NEXT:  76 | vbase_offset (-164)
183*f4a2713aSLionel Sambuc // CHECK-NEXT:  77 | vbase_offset (-160)
184*f4a2713aSLionel Sambuc // CHECK-NEXT:  78 | offset_to_top (-312)
185*f4a2713aSLionel Sambuc // CHECK-NEXT:  79 | Test1::C9 RTTI
186*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C2, 312) vtable address --
187*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C5, 312) vtable address --
188*f4a2713aSLionel Sambuc // CHECK-NEXT:  80 | vbase_offset (-180)
189*f4a2713aSLionel Sambuc // CHECK-NEXT:  81 | offset_to_top (-328)
190*f4a2713aSLionel Sambuc // CHECK-NEXT:  82 | Test1::C9 RTTI
191*f4a2713aSLionel Sambuc // CHECK-NEXT:       -- (Test1::C1, 328) vtable address --
192*f4a2713aSLionel Sambuc // CHECK-NEXT:  83 | vbase_offset (-196)
193*f4a2713aSLionel Sambuc // CHECK-NEXT:  84 | vbase_offset (-192)
194*f4a2713aSLionel Sambuc // CHECK-NEXT:  85 | offset_to_top (-344)
195*f4a2713aSLionel Sambuc // CHECK-NEXT:  86 | Test1::C9 RTTI
196*f4a2713aSLionel Sambuc class C9
197*f4a2713aSLionel Sambuc  :  virtual public C6
198*f4a2713aSLionel Sambuc  ,  public C2
199*f4a2713aSLionel Sambuc  ,  public C4
200*f4a2713aSLionel Sambuc  ,  virtual public C8
201*f4a2713aSLionel Sambuc {
202*f4a2713aSLionel Sambuc   int k0;
203*f4a2713aSLionel Sambuc   int k1;
204*f4a2713aSLionel Sambuc   int k2;
205*f4a2713aSLionel Sambuc   int k3;
206*f4a2713aSLionel Sambuc   virtual void f();
207*f4a2713aSLionel Sambuc };
f()208*f4a2713aSLionel Sambuc void C9::f() { }
209*f4a2713aSLionel Sambuc 
210*f4a2713aSLionel Sambuc }
211