blob: 802d18a069ee44c092bd9bce1fad11f62ea7b2a4 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
10#define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
11
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020012#include "llvm/ADT/StringRef.h"
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010013#include "llvm/DebugInfo/CodeView/CodeView.h"
14#include "llvm/DebugInfo/PDB/PDBTypes.h"
Andrew Scull0372a572018-11-16 15:47:06 +000015#include "llvm/Support/raw_ostream.h"
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020016#include <cstdint>
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010017#include <unordered_map>
18
19namespace llvm {
20
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010021namespace pdb {
22
23using TagStats = std::unordered_map<PDB_SymType, int>;
24
25raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
26raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
Andrew Scull0372a572018-11-16 15:47:06 +000027raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010028raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data);
Andrew Walbran3d2c1972020-04-07 12:24:26 +010029raw_ostream &operator<<(raw_ostream &OS,
30 const llvm::codeview::CPURegister &CpuReg);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010031raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
32raw_ostream &operator<<(raw_ostream &OS, const codeview::ThunkOrdinal &Thunk);
33raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
34raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
35raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
36raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access);
37raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
38raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010039
40raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
41raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
42raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
43
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020044raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression);
Andrew Scull0372a572018-11-16 15:47:06 +000045
46template <typename T>
47void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
48 OS << "\n";
49 OS.indent(Indent);
50 OS << Name << ": " << Value;
51}
52
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010053} // end namespace pdb
54
55} // end namespace llvm
56
57#endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H