1 The test input (every-type.pdb) is generated from some short and trivial C++ code
2 that exercises the entire type system to generate every possible type record that
3 we claim to understand. We then test this in two ways:
4 1) We just dump the output for the purposes of readability. This tests that we
5 we can dump every possible type record.
6 2) We dump the output to yaml, and then re-generate a PDB with the same type
7 stream, and then run test 1 on the new PDB. This verifies that the PDB
11 RUN: llvm-pdbutil dump -type-index=0x101A,0x102C,0x103D,0x104D,0x1098,0x10AA,0x10AC \
12 RUN: -dont-resolve-forward-refs -dependents %p/Inputs/every-type.pdb \
13 RUN: | FileCheck --check-prefix=TYPES %s
15 RUN: llvm-pdbutil pdb2yaml -tpi-stream -ipi-stream %p/Inputs/every-type.pdb > %t.pdb.yaml
16 RUN: llvm-pdbutil yaml2pdb -pdb=%t.yaml.pdb %t.pdb.yaml
17 RUN: llvm-pdbutil dump -type-index=0x101A,0x102C,0x103D,0x104D,0x1098,0x10AA,0x10AC \
18 RUN: -dependents -dont-resolve-forward-refs %t.yaml.pdb \
19 RUN: | FileCheck --check-prefix=TYPES %s
21 TYPES: Types (TPI Stream)
22 TYPES-NEXT: ============================================================
23 TYPES-NEXT: Showing 7 records and their dependents (72 records total)
24 TYPES-NEXT: 0x1007 | LF_MODIFIER [size = 12]
25 TYPES-NEXT: referent = 0x0074 (int), modifiers = const
26 TYPES-NEXT: 0x1008 | LF_CLASS [size = 48] `FooClass`
27 TYPES-NEXT: unique name: `.?AVFooClass@@`
28 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: <no type>
29 TYPES-NEXT: options: forward ref | has unique name, sizeof 0
30 TYPES-NEXT: 0x1009 | LF_VTSHAPE [size = 8]
31 TYPES-NEXT: 0x100A | LF_POINTER [size = 12]
32 TYPES-NEXT: referent = 0x1009, mode = pointer, opts = None, kind = ptr64
33 TYPES-NEXT: 0x100B | LF_CLASS [size = 44] `Inherit`
34 TYPES-NEXT: unique name: `.?AVInherit@@`
35 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: <no type>
36 TYPES-NEXT: options: forward ref | has unique name, sizeof 0
37 TYPES-NEXT: 0x100C | LF_POINTER [size = 12]
38 TYPES-NEXT: referent = 0x100B, mode = pointer, opts = const, kind = ptr64
39 TYPES-NEXT: 0x100D | LF_ARGLIST [size = 8]
40 TYPES-NEXT: 0x100E | LF_MFUNCTION [size = 28]
41 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
42 TYPES-NEXT: class type = 0x100B, this type = 0x100C, this adjust = 0
43 TYPES-NEXT: calling conv = cdecl, options = None
44 TYPES-NEXT: 0x100F | LF_MODIFIER [size = 12]
45 TYPES-NEXT: referent = 0x100B, modifiers = const
46 TYPES-NEXT: 0x1010 | LF_POINTER [size = 12]
47 TYPES-NEXT: referent = 0x100F, mode = ref, opts = None, kind = ptr64
48 TYPES-NEXT: 0x1011 | LF_ARGLIST [size = 12]
49 TYPES-NEXT: 0x1010: `const Inherit&`
50 TYPES-NEXT: 0x1012 | LF_MFUNCTION [size = 28]
51 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x1011
52 TYPES-NEXT: class type = 0x100B, this type = 0x100C, this adjust = 0
53 TYPES-NEXT: calling conv = cdecl, options = constructor
54 TYPES-NEXT: 0x1013 | LF_MFUNCTION [size = 28]
55 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
56 TYPES-NEXT: class type = 0x100B, this type = 0x100C, this adjust = 0
57 TYPES-NEXT: calling conv = cdecl, options = constructor
58 TYPES-NEXT: 0x1014 | LF_METHODLIST [size = 20]
59 TYPES-NEXT: - Method [type = 0x1012, vftable offset = -1, attrs = public compiler-generated]
60 TYPES-NEXT: - Method [type = 0x1013, vftable offset = -1, attrs = public compiler-generated]
61 TYPES-NEXT: 0x1015 | LF_POINTER [size = 12]
62 TYPES-NEXT: referent = 0x100B, mode = ref, opts = None, kind = ptr64
63 TYPES-NEXT: 0x1016 | LF_MFUNCTION [size = 28]
64 TYPES-NEXT: return type = 0x1015, # args = 1, param list = 0x1011
65 TYPES-NEXT: class type = 0x100B, this type = 0x100C, this adjust = 0
66 TYPES-NEXT: calling conv = cdecl, options = None
67 TYPES-NEXT: 0x1017 | LF_ARGLIST [size = 12]
68 TYPES-NEXT: 0x0075 (unsigned): `unsigned`
69 TYPES-NEXT: 0x1018 | LF_MFUNCTION [size = 28]
70 TYPES-NEXT: return type = 0x0603 (void*), # args = 1, param list = 0x1017
71 TYPES-NEXT: class type = 0x100B, this type = 0x100C, this adjust = 0
72 TYPES-NEXT: calling conv = cdecl, options = None
73 TYPES-NEXT: 0x1019 | LF_FIELDLIST [size = 152]
74 TYPES-NEXT: - LF_BCLASS
75 TYPES-NEXT: type = 0x1008, offset = 8, attrs = public
76 TYPES-NEXT: - LF_VFUNCTAB type = 0x100A
77 TYPES-NEXT: - LF_ONEMETHOD [name = `~Inherit`]
78 TYPES-NEXT: type = 0x100E, vftable offset = 0, attrs = public intro virtual
79 TYPES-NEXT: - LF_METHOD [name = `Inherit`, # overloads = 2, overload list = 0x1014]
80 TYPES-NEXT: - LF_ONEMETHOD [name = `operator=`]
81 TYPES-NEXT: type = 0x1016, vftable offset = -1, attrs = public compiler-generated
82 TYPES-NEXT: - LF_ONEMETHOD [name = `__local_vftable_ctor_closure`]
83 TYPES-NEXT: type = 0x100E, vftable offset = -1, attrs = public compiler-generated
84 TYPES-NEXT: - LF_ONEMETHOD [name = `__vecDelDtor`]
85 TYPES-NEXT: type = 0x1018, vftable offset = 0, attrs = public intro virtual compiler-generated
86 TYPES-NEXT: 0x101A | LF_CLASS [size = 44] `Inherit`
87 TYPES-NEXT: unique name: `.?AVInherit@@`
88 TYPES-NEXT: vtable: 0x1009, base list: <no type>, field list: 0x1019
89 TYPES-NEXT: options: has ctor / dtor | has unique name | overloaded operator | overloaded operator=, sizeof 16
90 TYPES-NEXT: 0x101B | LF_POINTER [size = 12]
91 TYPES-NEXT: referent = 0x1007, mode = pointer, opts = None, kind = ptr64
92 TYPES-NEXT: 0x101C | LF_CLASS [size = 48] `VInherit`
93 TYPES-NEXT: unique name: `.?AVVInherit@@`
94 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: <no type>
95 TYPES-NEXT: options: forward ref | has unique name, sizeof 0
96 TYPES-NEXT: 0x101D | LF_POINTER [size = 12]
97 TYPES-NEXT: referent = 0x101C, mode = pointer, opts = const, kind = ptr64
98 TYPES-NEXT: 0x101E | LF_POINTER [size = 12]
99 TYPES-NEXT: referent = 0x101C, mode = rvalue ref, opts = None, kind = ptr64
100 TYPES-NEXT: 0x101F | LF_ARGLIST [size = 12]
101 TYPES-NEXT: 0x101E: `VInherit&&`
102 TYPES-NEXT: 0x1020 | LF_MFUNCTION [size = 28]
103 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x101F
104 TYPES-NEXT: class type = 0x101C, this type = 0x101D, this adjust = 0
105 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
106 TYPES-NEXT: 0x1021 | LF_MODIFIER [size = 12]
107 TYPES-NEXT: referent = 0x101C, modifiers = const
108 TYPES-NEXT: 0x1022 | LF_POINTER [size = 12]
109 TYPES-NEXT: referent = 0x1021, mode = ref, opts = None, kind = ptr64
110 TYPES-NEXT: 0x1023 | LF_ARGLIST [size = 12]
111 TYPES-NEXT: 0x1022: `const VInherit&`
112 TYPES-NEXT: 0x1024 | LF_MFUNCTION [size = 28]
113 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x1023
114 TYPES-NEXT: class type = 0x101C, this type = 0x101D, this adjust = 0
115 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
116 TYPES-NEXT: 0x1025 | LF_MFUNCTION [size = 28]
117 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
118 TYPES-NEXT: class type = 0x101C, this type = 0x101D, this adjust = 0
119 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
120 TYPES-NEXT: 0x1026 | LF_METHODLIST [size = 28]
121 TYPES-NEXT: - Method [type = 0x1020, vftable offset = -1, attrs = public compiler-generated]
122 TYPES-NEXT: - Method [type = 0x1024, vftable offset = -1, attrs = public compiler-generated]
123 TYPES-NEXT: - Method [type = 0x1025, vftable offset = -1, attrs = public compiler-generated]
124 TYPES-NEXT: 0x1027 | LF_POINTER [size = 12]
125 TYPES-NEXT: referent = 0x101C, mode = ref, opts = None, kind = ptr64
126 TYPES-NEXT: 0x1028 | LF_MFUNCTION [size = 28]
127 TYPES-NEXT: return type = 0x1027, # args = 1, param list = 0x101F
128 TYPES-NEXT: class type = 0x101C, this type = 0x101D, this adjust = 0
129 TYPES-NEXT: calling conv = cdecl, options = None
130 TYPES-NEXT: 0x1029 | LF_MFUNCTION [size = 28]
131 TYPES-NEXT: return type = 0x1027, # args = 1, param list = 0x1023
132 TYPES-NEXT: class type = 0x101C, this type = 0x101D, this adjust = 0
133 TYPES-NEXT: calling conv = cdecl, options = None
134 TYPES-NEXT: 0x102A | LF_METHODLIST [size = 20]
135 TYPES-NEXT: - Method [type = 0x1028, vftable offset = -1, attrs = public compiler-generated]
136 TYPES-NEXT: - Method [type = 0x1029, vftable offset = -1, attrs = public compiler-generated]
137 TYPES-NEXT: 0x102B | LF_FIELDLIST [size = 60]
138 TYPES-NEXT: - LF_VBCLASS
139 TYPES-NEXT: base = 0x1008, vbptr = 0x101B, vbptr offset = 0, vtable index = 1
140 TYPES-NEXT: attrs = public
141 TYPES-NEXT: - LF_METHOD [name = `VInherit`, # overloads = 3, overload list = 0x1026]
142 TYPES-NEXT: - LF_METHOD [name = `operator=`, # overloads = 2, overload list = 0x102A]
143 TYPES-NEXT: 0x102C | LF_CLASS [size = 48] `VInherit`
144 TYPES-NEXT: unique name: `.?AVVInherit@@`
145 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: 0x102B
146 TYPES-NEXT: options: has ctor / dtor | has unique name | overloaded operator | overloaded operator=, sizeof 16
147 TYPES-NEXT: 0x102D | LF_CLASS [size = 48] `IVInherit`
148 TYPES-NEXT: unique name: `.?AVIVInherit@@`
149 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: <no type>
150 TYPES-NEXT: options: forward ref | has unique name, sizeof 0
151 TYPES-NEXT: 0x102E | LF_POINTER [size = 12]
152 TYPES-NEXT: referent = 0x102D, mode = pointer, opts = const, kind = ptr64
153 TYPES-NEXT: 0x102F | LF_POINTER [size = 12]
154 TYPES-NEXT: referent = 0x102D, mode = rvalue ref, opts = None, kind = ptr64
155 TYPES-NEXT: 0x1030 | LF_ARGLIST [size = 12]
156 TYPES-NEXT: 0x102F: `IVInherit&&`
157 TYPES-NEXT: 0x1031 | LF_MFUNCTION [size = 28]
158 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x1030
159 TYPES-NEXT: class type = 0x102D, this type = 0x102E, this adjust = 0
160 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
161 TYPES-NEXT: 0x1032 | LF_MODIFIER [size = 12]
162 TYPES-NEXT: referent = 0x102D, modifiers = const
163 TYPES-NEXT: 0x1033 | LF_POINTER [size = 12]
164 TYPES-NEXT: referent = 0x1032, mode = ref, opts = None, kind = ptr64
165 TYPES-NEXT: 0x1034 | LF_ARGLIST [size = 12]
166 TYPES-NEXT: 0x1033: `const IVInherit&`
167 TYPES-NEXT: 0x1035 | LF_MFUNCTION [size = 28]
168 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x1034
169 TYPES-NEXT: class type = 0x102D, this type = 0x102E, this adjust = 0
170 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
171 TYPES-NEXT: 0x1036 | LF_MFUNCTION [size = 28]
172 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
173 TYPES-NEXT: class type = 0x102D, this type = 0x102E, this adjust = 0
174 TYPES-NEXT: calling conv = cdecl, options = constructor with virtual bases | constructor
175 TYPES-NEXT: 0x1037 | LF_METHODLIST [size = 28]
176 TYPES-NEXT: - Method [type = 0x1031, vftable offset = -1, attrs = public compiler-generated]
177 TYPES-NEXT: - Method [type = 0x1035, vftable offset = -1, attrs = public compiler-generated]
178 TYPES-NEXT: - Method [type = 0x1036, vftable offset = -1, attrs = public compiler-generated]
179 TYPES-NEXT: 0x1038 | LF_POINTER [size = 12]
180 TYPES-NEXT: referent = 0x102D, mode = ref, opts = None, kind = ptr64
181 TYPES-NEXT: 0x1039 | LF_MFUNCTION [size = 28]
182 TYPES-NEXT: return type = 0x1038, # args = 1, param list = 0x1030
183 TYPES-NEXT: class type = 0x102D, this type = 0x102E, this adjust = 0
184 TYPES-NEXT: calling conv = cdecl, options = None
185 TYPES-NEXT: 0x103A | LF_MFUNCTION [size = 28]
186 TYPES-NEXT: return type = 0x1038, # args = 1, param list = 0x1034
187 TYPES-NEXT: class type = 0x102D, this type = 0x102E, this adjust = 0
188 TYPES-NEXT: calling conv = cdecl, options = None
189 TYPES-NEXT: 0x103B | LF_METHODLIST [size = 20]
190 TYPES-NEXT: - Method [type = 0x1039, vftable offset = -1, attrs = public compiler-generated]
191 TYPES-NEXT: - Method [type = 0x103A, vftable offset = -1, attrs = public compiler-generated]
192 TYPES-NEXT: 0x103C | LF_FIELDLIST [size = 72]
193 TYPES-NEXT: - LF_BCLASS
194 TYPES-NEXT: type = 0x101C, offset = 0, attrs = public
195 TYPES-NEXT: - LF_IVBCLASS
196 TYPES-NEXT: base = 0x1008, vbptr = 0x101B, vbptr offset = 0, vtable index = 1
197 TYPES-NEXT: attrs = public
198 TYPES-NEXT: - LF_METHOD [name = `IVInherit`, # overloads = 3, overload list = 0x1037]
199 TYPES-NEXT: - LF_METHOD [name = `operator=`, # overloads = 2, overload list = 0x103B]
200 TYPES-NEXT: 0x103D | LF_CLASS [size = 48] `IVInherit`
201 TYPES-NEXT: unique name: `.?AVIVInherit@@`
202 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: 0x103C
203 TYPES-NEXT: options: has ctor / dtor | has unique name | overloaded operator | overloaded operator=, sizeof 16
204 TYPES-NEXT: 0x1041 | LF_FIELDLIST [size = 28]
205 TYPES-NEXT: - LF_ENUMERATE [A = 0]
206 TYPES-NEXT: - LF_ENUMERATE [B = 1]
207 TYPES-NEXT: - LF_ENUMERATE [C = 2]
208 TYPES-NEXT: 0x1042 | LF_ENUM [size = 64] `FooClass::NestedEnum`
209 TYPES-NEXT: unique name: `.?AW4NestedEnum@FooClass@@`
210 TYPES-NEXT: field list: 0x1041, underlying type: 0x0074 (int)
211 TYPES-NEXT: options: has unique name | is nested
212 TYPES-NEXT: 0x1043 | LF_POINTER [size = 12]
213 TYPES-NEXT: referent = 0x1008, mode = pointer, opts = const, kind = ptr64
214 TYPES-NEXT: 0x1044 | LF_MFUNCTION [size = 28]
215 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
216 TYPES-NEXT: class type = 0x1008, this type = 0x1043, this adjust = 0
217 TYPES-NEXT: calling conv = cdecl, options = None
218 TYPES-NEXT: 0x1045 | LF_ARGLIST [size = 16]
219 TYPES-NEXT: 0x0074 (int): `int`
220 TYPES-NEXT: 0x0074 (int): `int`
221 TYPES-NEXT: 0x1046 | LF_MFUNCTION [size = 28]
222 TYPES-NEXT: return type = 0x0003 (void), # args = 2, param list = 0x1045
223 TYPES-NEXT: class type = 0x1008, this type = 0x1043, this adjust = 0
224 TYPES-NEXT: calling conv = cdecl, options = None
225 TYPES-NEXT: 0x1047 | LF_ARGLIST [size = 12]
226 TYPES-NEXT: 0x0074 (int): `int`
227 TYPES-NEXT: 0x1048 | LF_MFUNCTION [size = 28]
228 TYPES-NEXT: return type = 0x0003 (void), # args = 1, param list = 0x1047
229 TYPES-NEXT: class type = 0x1008, this type = 0x1043, this adjust = 0
230 TYPES-NEXT: calling conv = cdecl, options = None
231 TYPES-NEXT: 0x1049 | LF_METHODLIST [size = 20]
232 TYPES-NEXT: - Method [type = 0x1046, vftable offset = -1, attrs = public]
233 TYPES-NEXT: - Method [type = 0x1048, vftable offset = -1, attrs = public]
234 TYPES-NEXT: 0x104A | LF_BITFIELD [size = 12]
235 TYPES-NEXT: type = 0x0074 (int), bit offset = 0, # bits = 4
236 TYPES-NEXT: 0x104B | LF_BITFIELD [size = 12]
237 TYPES-NEXT: type = 0x0074 (int), bit offset = 4, # bits = 4
238 TYPES-NEXT: 0x104C | LF_FIELDLIST [size = 164]
239 TYPES-NEXT: - LF_NESTTYPE [name = `NestedEnum`, parent = 0x1042]
240 TYPES-NEXT: - LF_ONEMETHOD [name = `RegularMethod`]
241 TYPES-NEXT: type = 0x1044, vftable offset = -1, attrs = public
242 TYPES-NEXT: - LF_METHOD [name = `OverloadedMethod`, # overloads = 2, overload list = 0x1049]
243 TYPES-NEXT: - LF_MEMBER [name = `HiNibble`, Type = 0x104A, offset = 0, attrs = public]
244 TYPES-NEXT: - LF_MEMBER [name = `LoNibble`, Type = 0x104B, offset = 0, attrs = public]
245 TYPES-NEXT: - LF_MEMBER [name = `EnumVariable`, Type = 0x1042, offset = 4, attrs = public]
246 TYPES-NEXT: - LF_STMEMBER [name = `StaticMember`, type = 0x0603 (void*), attrs = public]
247 TYPES-NEXT: 0x104D | LF_CLASS [size = 48] `FooClass`
248 TYPES-NEXT: unique name: `.?AVFooClass@@`
249 TYPES-NEXT: vtable: <no type>, base list: <no type>, field list: 0x104C
250 TYPES-NEXT: options: contains nested class | has unique name, sizeof 8
251 TYPES-NEXT: 0x1098 | LF_UNION [size = 40] `TheUnion`
252 TYPES-NEXT: unique name: `.?ATTheUnion@@`
253 TYPES-NEXT: field list: <no type>
254 TYPES-NEXT: options: forward ref | has unique name, sizeof 0
255 TYPES-NEXT: 0x10AA | LF_PROCEDURE [size = 16]
256 TYPES-NEXT: return type = 0x0003 (void), # args = 0, param list = 0x100D
257 TYPES-NEXT: calling conv = cdecl, options = None
258 TYPES-NEXT: 0x10AB | LF_POINTER [size = 12]
259 TYPES-NEXT: referent = 0x10AA, mode = pointer, opts = const, kind = ptr64
260 TYPES-NEXT: 0x10AC | LF_ARRAY [size = 16]
261 TYPES-NEXT: size: 8, index type: 0x0023 (unsigned __int64), element type: 0x10AB