1 //===- PDBExtras.cpp - helper functions and classes for PDBs -----*- C++-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/DebugInfo/PDB/PDBExtras.h"
11
12 #include "llvm/ADT/ArrayRef.h"
13
14 using namespace llvm;
15 using namespace llvm::pdb;
16
17 #define CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, Str, Stream) \
18 case Class::Value: \
19 Stream << Str; \
20 break;
21
22 #define CASE_OUTPUT_ENUM_CLASS_NAME(Class, Value, Stream) \
23 CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, #Value, Stream)
24
operator <<(raw_ostream & OS,const PDB_VariantType & Type)25 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
26 const PDB_VariantType &Type) {
27 switch (Type) {
28 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Bool, OS)
29 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Single, OS)
30 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Double, OS)
31 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int8, OS)
32 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int16, OS)
33 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int32, OS)
34 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int64, OS)
35 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt8, OS)
36 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt16, OS)
37 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt32, OS)
38 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt64, OS)
39 default:
40 OS << "Unknown";
41 }
42 return OS;
43 }
44
operator <<(raw_ostream & OS,const PDB_CallingConv & Conv)45 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
46 const PDB_CallingConv &Conv) {
47 OS << "__";
48 switch (Conv) {
49 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearC , "cdecl", OS)
50 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarC , "cdecl", OS)
51 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearPascal , "pascal", OS)
52 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarPascal , "pascal", OS)
53 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearFast , "fastcall", OS)
54 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarFast , "fastcall", OS)
55 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearStdCall, "stdcall", OS)
56 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarStdCall , "stdcall", OS)
57 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearSysCall, "syscall", OS)
58 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarSysCall , "syscall", OS)
59 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ThisCall , "thiscall", OS)
60 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, MipsCall , "mipscall", OS)
61 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Generic , "genericcall", OS)
62 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AlphaCall , "alphacall", OS)
63 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, PpcCall , "ppccall", OS)
64 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SHCall , "superhcall", OS)
65 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ArmCall , "armcall", OS)
66 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AM33Call , "am33call", OS)
67 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, TriCall , "tricall", OS)
68 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SH5Call , "sh5call", OS)
69 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, M32RCall , "m32rcall", OS)
70 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ClrCall , "clrcall", OS)
71 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Inline , "inlinecall", OS)
72 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearVector , "vectorcall", OS)
73 }
74 return OS;
75 }
76
operator <<(raw_ostream & OS,const PDB_DataKind & Data)77 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
78 switch (Data) {
79 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Unknown, "unknown", OS)
80 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Local, "local", OS)
81 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticLocal, "static local", OS)
82 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Param, "param", OS)
83 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, ObjectPtr, "this ptr", OS)
84 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, FileStatic, "static global", OS)
85 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Global, "global", OS)
86 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Member, "member", OS)
87 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticMember, "static member", OS)
88 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Constant, "const", OS)
89 }
90 return OS;
91 }
92
operator <<(raw_ostream & OS,const codeview::RegisterId & Reg)93 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
94 const codeview::RegisterId &Reg) {
95 switch (Reg) {
96 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, AL, OS)
97 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, CL, OS)
98 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, DL, OS)
99 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, BL, OS)
100 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, AH, OS)
101 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, CH, OS)
102 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, DH, OS)
103 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, BH, OS)
104 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, AX, OS)
105 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, CX, OS)
106 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, DX, OS)
107 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, BX, OS)
108 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, SP, OS)
109 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, BP, OS)
110 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, SI, OS)
111 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, DI, OS)
112 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, EAX, OS)
113 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, ECX, OS)
114 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, EDX, OS)
115 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, EBX, OS)
116 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, ESP, OS)
117 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, EBP, OS)
118 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, ESI, OS)
119 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, EDI, OS)
120 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, ES, OS)
121 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, CS, OS)
122 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, SS, OS)
123 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, DS, OS)
124 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, FS, OS)
125 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, GS, OS)
126 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, IP, OS)
127 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RAX, OS)
128 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RBX, OS)
129 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RCX, OS)
130 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RDX, OS)
131 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RSI, OS)
132 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RDI, OS)
133 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RBP, OS)
134 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, RSP, OS)
135 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R8, OS)
136 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R9, OS)
137 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R10, OS)
138 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R11, OS)
139 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R12, OS)
140 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R13, OS)
141 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R14, OS)
142 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::RegisterId, R15, OS)
143 default:
144 OS << static_cast<int>(Reg);
145 }
146 return OS;
147 }
148
operator <<(raw_ostream & OS,const PDB_LocType & Loc)149 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_LocType &Loc) {
150 switch (Loc) {
151 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Static, "static", OS)
152 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, TLS, "tls", OS)
153 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, RegRel, "regrel", OS)
154 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, ThisRel, "thisrel", OS)
155 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Enregistered, "register", OS)
156 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, BitField, "bitfield", OS)
157 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Slot, "slot", OS)
158 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, IlRel, "IL rel", OS)
159 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, MetaData, "metadata", OS)
160 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Constant, "constant", OS)
161 default:
162 OS << "Unknown";
163 }
164 return OS;
165 }
166
operator <<(raw_ostream & OS,const codeview::ThunkOrdinal & Thunk)167 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
168 const codeview::ThunkOrdinal &Thunk) {
169 switch (Thunk) {
170 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, BranchIsland, OS)
171 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Pcode, OS)
172 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Standard, OS)
173 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, ThisAdjustor, OS)
174 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, TrampIncremental, OS)
175 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, UnknownLoad, OS)
176 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Vcall, OS)
177 }
178 return OS;
179 }
180
operator <<(raw_ostream & OS,const PDB_Checksum & Checksum)181 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
182 const PDB_Checksum &Checksum) {
183 switch (Checksum) {
184 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, None, OS)
185 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, MD5, OS)
186 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, SHA1, OS)
187 }
188 return OS;
189 }
190
operator <<(raw_ostream & OS,const PDB_Lang & Lang)191 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
192 switch (Lang) {
193 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, C, OS)
194 CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, Cpp, "C++", OS)
195 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Fortran, OS)
196 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Masm, OS)
197 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Pascal, OS)
198 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Basic, OS)
199 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cobol, OS)
200 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Link, OS)
201 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtres, OS)
202 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtpgd, OS)
203 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, CSharp, OS)
204 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, VB, OS)
205 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ILAsm, OS)
206 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Java, OS)
207 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, JScript, OS)
208 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
209 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
210 }
211 return OS;
212 }
213
operator <<(raw_ostream & OS,const PDB_SymType & Tag)214 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_SymType &Tag) {
215 switch (Tag) {
216 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Exe, OS)
217 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Compiland, OS)
218 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandDetails, OS)
219 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandEnv, OS)
220 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Function, OS)
221 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Block, OS)
222 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Data, OS)
223 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Annotation, OS)
224 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Label, OS)
225 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PublicSymbol, OS)
226 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UDT, OS)
227 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Enum, OS)
228 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionSig, OS)
229 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PointerType, OS)
230 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ArrayType, OS)
231 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BuiltinType, OS)
232 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Typedef, OS)
233 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BaseClass, OS)
234 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Friend, OS)
235 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionArg, OS)
236 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugStart, OS)
237 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugEnd, OS)
238 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UsingNamespace, OS)
239 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTableShape, OS)
240 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTable, OS)
241 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Custom, OS)
242 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Thunk, OS)
243 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CustomType, OS)
244 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ManagedType, OS)
245 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Dimension, OS)
246 default:
247 OS << "Unknown";
248 }
249 return OS;
250 }
251
operator <<(raw_ostream & OS,const PDB_MemberAccess & Access)252 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
253 const PDB_MemberAccess &Access) {
254 switch (Access) {
255 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Public, "public", OS)
256 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Protected, "protected", OS)
257 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Private, "private", OS)
258 }
259 return OS;
260 }
261
operator <<(raw_ostream & OS,const PDB_UdtType & Type)262 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_UdtType &Type) {
263 switch (Type) {
264 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Class, "class", OS)
265 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Struct, "struct", OS)
266 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Interface, "interface", OS)
267 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Union, "union", OS)
268 }
269 return OS;
270 }
271
operator <<(raw_ostream & OS,const PDB_UniqueId & Id)272 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_UniqueId &Id) {
273 static const char *Lookup = "0123456789ABCDEF";
274
275 static_assert(sizeof(PDB_UniqueId) == 16, "Expected 16-byte GUID");
276 ArrayRef<uint8_t> GuidBytes(reinterpret_cast<const uint8_t*>(&Id), 16);
277 OS << "{";
278 for (int i=0; i < 16;) {
279 uint8_t Byte = GuidBytes[i];
280 uint8_t HighNibble = (Byte >> 4) & 0xF;
281 uint8_t LowNibble = Byte & 0xF;
282 OS << Lookup[HighNibble] << Lookup[LowNibble];
283 ++i;
284 if (i>=4 && i<=10 && i%2==0)
285 OS << "-";
286 }
287 OS << "}";
288 return OS;
289 }
290
operator <<(raw_ostream & OS,const PDB_Machine & Machine)291 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
292 const PDB_Machine &Machine) {
293 switch (Machine) {
294 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Am33, OS)
295 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Amd64, OS)
296 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Arm, OS)
297 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, ArmNT, OS)
298 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Ebc, OS)
299 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, x86, OS)
300 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Ia64, OS)
301 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, M32R, OS)
302 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Mips16, OS)
303 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, MipsFpu, OS)
304 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, MipsFpu16, OS)
305 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, PowerPC, OS)
306 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, PowerPCFP, OS)
307 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, R4000, OS)
308 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH3, OS)
309 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH3DSP, OS)
310 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH4, OS)
311 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH5, OS)
312 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Thumb, OS)
313 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, WceMipsV2, OS)
314 default:
315 OS << "Unknown";
316 }
317 return OS;
318 }
319
operator <<(raw_ostream & OS,const Variant & Value)320 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const Variant &Value) {
321 switch (Value.Type) {
322 case PDB_VariantType::Bool:
323 OS << (Value.Value.Bool ? "true" : "false");
324 break;
325 case PDB_VariantType::Double:
326 OS << Value.Value.Double;
327 break;
328 case PDB_VariantType::Int16:
329 OS << Value.Value.Int16;
330 break;
331 case PDB_VariantType::Int32:
332 OS << Value.Value.Int32;
333 break;
334 case PDB_VariantType::Int64:
335 OS << Value.Value.Int64;
336 break;
337 case PDB_VariantType::Int8:
338 OS << static_cast<int>(Value.Value.Int8);
339 break;
340 case PDB_VariantType::Single:
341 OS << Value.Value.Single;
342 break;
343 case PDB_VariantType::UInt16:
344 OS << Value.Value.Double;
345 break;
346 case PDB_VariantType::UInt32:
347 OS << Value.Value.UInt32;
348 break;
349 case PDB_VariantType::UInt64:
350 OS << Value.Value.UInt64;
351 break;
352 case PDB_VariantType::UInt8:
353 OS << static_cast<unsigned>(Value.Value.UInt8);
354 break;
355 case PDB_VariantType::String:
356 OS << Value.Value.String;
357 break;
358 default:
359 OS << Value.Type;
360 }
361 return OS;
362 }
363
operator <<(raw_ostream & OS,const VersionInfo & Version)364 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
365 const VersionInfo &Version) {
366 OS << Version.Major << "." << Version.Minor << "." << Version.Build;
367 return OS;
368 }
369
operator <<(raw_ostream & OS,const TagStats & Stats)370 raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const TagStats &Stats) {
371 for (auto Tag : Stats) {
372 OS << Tag.first << ":" << Tag.second << " ";
373 }
374 return OS;
375 }
376