1 //===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
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 #ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
10 #define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
11
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/PDB/PDBTypes.h"
15 #include "llvm/Support/Compiler.h"
16 #include "llvm/Support/raw_ostream.h"
17 #include <cstdint>
18 #include <unordered_map>
19
20 namespace llvm {
21
22 namespace pdb {
23
24 using TagStats = std::unordered_map<PDB_SymType, int>;
25
26 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
27 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
28 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type);
29 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data);
30 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
31 const llvm::codeview::CPURegister &CpuReg);
32 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
33 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
34 const codeview::ThunkOrdinal &Thunk);
35 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
36 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
37 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
38 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS,
39 const PDB_MemberAccess &Access);
40 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
41 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
42
43 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
44 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
45 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
46
47 LLVM_ABI raw_ostream &dumpPDBSourceCompression(raw_ostream &OS,
48 uint32_t Compression);
49
50 template <typename T>
dumpSymbolField(raw_ostream & OS,StringRef Name,T Value,int Indent)51 void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
52 OS << "\n";
53 OS.indent(Indent);
54 OS << Name << ": " << Value;
55 }
56
57 } // end namespace pdb
58
59 } // end namespace llvm
60
61 #endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
62