1//===- PDBExtras.cpp - helper functions and classes for PDBs --------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/PDB/PDBExtras.h"
10#include "llvm/Support/raw_ostream.h"
11
12using namespace llvm;
13using namespace llvm::pdb;
14
15#define CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, Str, Stream) \
16 case Class::Value: \
17 Stream << Str; \
18 break;
19
20#define CASE_OUTPUT_ENUM_CLASS_NAME(Class, Value, Stream) \
21 CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, #Value, Stream)
22
23raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
24 const PDB_VariantType &Type) {
25 switch (Type) {
26 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Bool, OS)
27 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Single, OS)
28 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Double, OS)
29 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int8, OS)
30 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int16, OS)
31 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int32, OS)
32 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, Int64, OS)
33 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt8, OS)
34 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt16, OS)
35 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt32, OS)
36 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_VariantType, UInt64, OS)
37 default:
38 OS << "Unknown";
39 }
40 return OS;
41}
42
43raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
44 const PDB_BuiltinType &Type) {
45 switch (Type) {
46 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, None, OS)
47 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Void, OS)
48 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char, OS)
49 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, WCharT, OS)
50 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Int, OS)
51 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, UInt, OS)
52 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Float, OS)
53 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, BCD, OS)
54 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Bool, OS)
55 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Long, OS)
56 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, ULong, OS)
57 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Currency, OS)
58 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Date, OS)
59 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Variant, OS)
60 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Complex, OS)
61 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Bitfield, OS)
62 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, BSTR, OS)
63 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, HResult, OS)
64 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char16, OS)
65 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char32, OS)
66 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_BuiltinType, Char8, OS)
67 }
68 return OS;
69}
70
71raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
72 const PDB_CallingConv &Conv) {
73 OS << "__";
74 switch (Conv) {
75 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearC , "cdecl", OS)
76 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarC , "cdecl", OS)
77 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearPascal , "pascal", OS)
78 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarPascal , "pascal", OS)
79 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearFast , "fastcall", OS)
80 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarFast , "fastcall", OS)
81 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearStdCall, "stdcall", OS)
82 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarStdCall , "stdcall", OS)
83 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearSysCall, "syscall", OS)
84 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, FarSysCall , "syscall", OS)
85 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ThisCall , "thiscall", OS)
86 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, MipsCall , "mipscall", OS)
87 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Generic , "genericcall", OS)
88 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AlphaCall , "alphacall", OS)
89 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, PpcCall , "ppccall", OS)
90 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SHCall , "superhcall", OS)
91 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ArmCall , "armcall", OS)
92 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, AM33Call , "am33call", OS)
93 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, TriCall , "tricall", OS)
94 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, SH5Call , "sh5call", OS)
95 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, M32RCall , "m32rcall", OS)
96 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ClrCall , "clrcall", OS)
97 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Inline , "inlinecall", OS)
98 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearVector , "vectorcall", OS)
99 CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Swift, "swiftcall", OS)
100 }
101 return OS;
102}
103
104raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_DataKind &Data) {
105 switch (Data) {
106 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Unknown, "unknown", OS)
107 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Local, "local", OS)
108 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticLocal, "static local", OS)
109 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Param, "param", OS)
110 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, ObjectPtr, "this ptr", OS)
111 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, FileStatic, "static global", OS)
112 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Global, "global", OS)
113 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Member, "member", OS)
114 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, StaticMember, "static member", OS)
115 CASE_OUTPUT_ENUM_CLASS_STR(PDB_DataKind, Constant, "const", OS)
116 }
117 return OS;
118}
119
120raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
121 const llvm::codeview::CPURegister &CpuReg) {
122 if (CpuReg.Cpu == llvm::codeview::CPUType::ARMNT) {
123 switch (CpuReg.Reg) {
124#define CV_REGISTERS_ARM
125#define CV_REGISTER(name, val) \
126 case codeview::RegisterId::name: \
127 OS << #name; \
128 return OS;
129#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
130#undef CV_REGISTER
131#undef CV_REGISTERS_ARM
132
133 default:
134 break;
135 }
136 } else if (CpuReg.Cpu == llvm::codeview::CPUType::ARM64) {
137 switch (CpuReg.Reg) {
138#define CV_REGISTERS_ARM64
139#define CV_REGISTER(name, val) \
140 case codeview::RegisterId::name: \
141 OS << #name; \
142 return OS;
143#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
144#undef CV_REGISTER
145#undef CV_REGISTERS_ARM64
146
147 default:
148 break;
149 }
150 } else {
151 switch (CpuReg.Reg) {
152#define CV_REGISTERS_X86
153#define CV_REGISTER(name, val) \
154 case codeview::RegisterId::name: \
155 OS << #name; \
156 return OS;
157#include "llvm/DebugInfo/CodeView/CodeViewRegisters.def"
158#undef CV_REGISTER
159#undef CV_REGISTERS_X86
160
161 default:
162 break;
163 }
164 }
165 OS << static_cast<int>(CpuReg.Reg);
166 return OS;
167}
168
169raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_LocType &Loc) {
170 switch (Loc) {
171 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Static, "static", OS)
172 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, TLS, "tls", OS)
173 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, RegRel, "regrel", OS)
174 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, ThisRel, "thisrel", OS)
175 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Enregistered, "register", OS)
176 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, BitField, "bitfield", OS)
177 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Slot, "slot", OS)
178 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, IlRel, "IL rel", OS)
179 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, MetaData, "metadata", OS)
180 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, Constant, "constant", OS)
181 CASE_OUTPUT_ENUM_CLASS_STR(PDB_LocType, RegRelAliasIndir,
182 "regrelaliasindir", OS)
183 default:
184 OS << "Unknown";
185 }
186 return OS;
187}
188
189raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
190 const codeview::ThunkOrdinal &Thunk) {
191 switch (Thunk) {
192 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, BranchIsland, OS)
193 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Pcode, OS)
194 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Standard, OS)
195 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, ThisAdjustor, OS)
196 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, TrampIncremental, OS)
197 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, UnknownLoad, OS)
198 CASE_OUTPUT_ENUM_CLASS_NAME(codeview::ThunkOrdinal, Vcall, OS)
199 }
200 return OS;
201}
202
203raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
204 const PDB_Checksum &Checksum) {
205 switch (Checksum) {
206 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, None, OS)
207 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, MD5, OS)
208 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, SHA1, OS)
209 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, SHA256, OS)
210 }
211 return OS;
212}
213
214raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
215 switch (Lang) {
216 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, C, OS)
217 CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, Cpp, "C++", OS)
218 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Fortran, OS)
219 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Masm, OS)
220 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Pascal, OS)
221 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Basic, OS)
222 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cobol, OS)
223 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Link, OS)
224 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtres, OS)
225 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtpgd, OS)
226 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, CSharp, OS)
227 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, VB, OS)
228 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ILAsm, OS)
229 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Java, OS)
230 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, JScript, OS)
231 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
232 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
233 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, D, OS)
234 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Swift, OS)
235 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Rust, OS)
236 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ObjC, OS)
237 CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, ObjCpp, "ObjC++", OS)
238 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, AliasObj, OS)
239 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Go, OS)
240 CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, OldSwift, "Swift", OS)
241 }
242 return OS;
243}
244
245raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_SymType &Tag) {
246 switch (Tag) {
247 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Exe, OS)
248 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Compiland, OS)
249 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandDetails, OS)
250 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandEnv, OS)
251 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Function, OS)
252 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Block, OS)
253 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Data, OS)
254 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Annotation, OS)
255 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Label, OS)
256 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PublicSymbol, OS)
257 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UDT, OS)
258 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Enum, OS)
259 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionSig, OS)
260 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PointerType, OS)
261 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ArrayType, OS)
262 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BuiltinType, OS)
263 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Typedef, OS)
264 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BaseClass, OS)
265 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Friend, OS)
266 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionArg, OS)
267 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugStart, OS)
268 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugEnd, OS)
269 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UsingNamespace, OS)
270 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTableShape, OS)
271 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTable, OS)
272 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Custom, OS)
273 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Thunk, OS)
274 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CustomType, OS)
275 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ManagedType, OS)
276 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Dimension, OS)
277 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CallSite, OS)
278 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, InlineSite, OS)
279 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BaseInterface, OS)
280 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VectorType, OS)
281 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, MatrixType, OS)
282 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, HLSLType, OS)
283 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Caller, OS)
284 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Callee, OS)
285 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Export, OS)
286 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, HeapAllocationSite, OS)
287 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CoffGroup, OS)
288 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Inlinee, OS)
289 default:
290 OS << "Unknown SymTag " << uint32_t(Tag);
291 }
292 return OS;
293}
294
295raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
296 const PDB_MemberAccess &Access) {
297 switch (Access) {
298 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Public, "public", OS)
299 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Protected, "protected", OS)
300 CASE_OUTPUT_ENUM_CLASS_STR(PDB_MemberAccess, Private, "private", OS)
301 }
302 return OS;
303}
304
305raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_UdtType &Type) {
306 switch (Type) {
307 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Class, "class", OS)
308 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Struct, "struct", OS)
309 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Interface, "interface", OS)
310 CASE_OUTPUT_ENUM_CLASS_STR(PDB_UdtType, Union, "union", OS)
311 }
312 return OS;
313}
314
315raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
316 const PDB_Machine &Machine) {
317 switch (Machine) {
318 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Am33, OS)
319 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Amd64, OS)
320 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Arm, OS)
321 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, ArmNT, OS)
322 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Ebc, OS)
323 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, x86, OS)
324 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Ia64, OS)
325 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, M32R, OS)
326 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Mips16, OS)
327 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, MipsFpu, OS)
328 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, MipsFpu16, OS)
329 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, PowerPC, OS)
330 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, PowerPCFP, OS)
331 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, R4000, OS)
332 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH3, OS)
333 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH3DSP, OS)
334 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH4, OS)
335 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, SH5, OS)
336 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, Thumb, OS)
337 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Machine, WceMipsV2, OS)
338 default:
339 OS << "Unknown";
340 }
341 return OS;
342}
343
344raw_ostream &llvm::pdb::dumpPDBSourceCompression(raw_ostream &OS,
345 uint32_t Compression) {
346 switch (Compression) {
347 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, None, OS)
348 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, Huffman, OS)
349 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, LZ, OS)
350 CASE_OUTPUT_ENUM_CLASS_STR(PDB_SourceCompression, RunLengthEncoded, "RLE",
351 OS)
352 CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, DotNet, OS)
353 default:
354 OS << "Unknown (" << Compression << ")";
355 }
356 return OS;
357}
358
359raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const Variant &Value) {
360 switch (Value.Type) {
361 case PDB_VariantType::Bool:
362 OS << (Value.Value.Bool ? "true" : "false");
363 break;
364 case PDB_VariantType::Double:
365 OS << Value.Value.Double;
366 break;
367 case PDB_VariantType::Int16:
368 OS << Value.Value.Int16;
369 break;
370 case PDB_VariantType::Int32:
371 OS << Value.Value.Int32;
372 break;
373 case PDB_VariantType::Int64:
374 OS << Value.Value.Int64;
375 break;
376 case PDB_VariantType::Int8:
377 OS << static_cast<int>(Value.Value.Int8);
378 break;
379 case PDB_VariantType::Single:
380 OS << Value.Value.Single;
381 break;
382 case PDB_VariantType::UInt16:
383 OS << Value.Value.UInt16;
384 break;
385 case PDB_VariantType::UInt32:
386 OS << Value.Value.UInt32;
387 break;
388 case PDB_VariantType::UInt64:
389 OS << Value.Value.UInt64;
390 break;
391 case PDB_VariantType::UInt8:
392 OS << static_cast<unsigned>(Value.Value.UInt8);
393 break;
394 case PDB_VariantType::String:
395 OS << Value.Value.String;
396 break;
397 default:
398 OS << Value.Type;
399 }
400 return OS;
401}
402
403raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
404 const VersionInfo &Version) {
405 OS << Version.Major << "." << Version.Minor << "." << Version.Build;
406 return OS;
407}
408
409raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const TagStats &Stats) {
410 for (auto Tag : Stats) {
411 OS << Tag.first << ":" << Tag.second << " ";
412 }
413 return OS;
414}
415