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