Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H |
| 10 | #define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H |
| 11 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 12 | #include "llvm/ADT/StringRef.h" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 13 | #include "llvm/DebugInfo/CodeView/CodeView.h" |
| 14 | #include "llvm/DebugInfo/PDB/PDBTypes.h" |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 15 | #include "llvm/Support/raw_ostream.h" |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 16 | #include <cstdint> |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 17 | #include <unordered_map> |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 21 | namespace pdb { |
| 22 | |
| 23 | using TagStats = std::unordered_map<PDB_SymType, int>; |
| 24 | |
| 25 | raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value); |
| 26 | raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv); |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 27 | raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 28 | raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 29 | raw_ostream &operator<<(raw_ostream &OS, |
| 30 | const llvm::codeview::CPURegister &CpuReg); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 31 | raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc); |
| 32 | raw_ostream &operator<<(raw_ostream &OS, const codeview::ThunkOrdinal &Thunk); |
| 33 | raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum); |
| 34 | raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang); |
| 35 | raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag); |
| 36 | raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access); |
| 37 | raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type); |
| 38 | raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 39 | |
| 40 | raw_ostream &operator<<(raw_ostream &OS, const Variant &Value); |
| 41 | raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version); |
| 42 | raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats); |
| 43 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 44 | raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression); |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 45 | |
| 46 | template <typename T> |
| 47 | void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) { |
| 48 | OS << "\n"; |
| 49 | OS.indent(Indent); |
| 50 | OS << Name << ": " << Value; |
| 51 | } |
| 52 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 53 | } // end namespace pdb |
| 54 | |
| 55 | } // end namespace llvm |
| 56 | |
| 57 | #endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H |