PDBExtras.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
  9. #define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
  10. #include "llvm/ADT/StringRef.h"
  11. #include "llvm/DebugInfo/CodeView/CodeView.h"
  12. #include "llvm/DebugInfo/PDB/PDBTypes.h"
  13. #include "llvm/Support/raw_ostream.h"
  14. #include <cstdint>
  15. #include <unordered_map>
  16. namespace llvm {
  17. namespace pdb {
  18. using TagStats = std::unordered_map<PDB_SymType, int>;
  19. raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
  20. raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
  21. raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type);
  22. raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data);
  23. raw_ostream &operator<<(raw_ostream &OS,
  24. const llvm::codeview::CPURegister &CpuReg);
  25. raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
  26. raw_ostream &operator<<(raw_ostream &OS, const codeview::ThunkOrdinal &Thunk);
  27. raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
  28. raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
  29. raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
  30. raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access);
  31. raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
  32. raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
  33. raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
  34. raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
  35. raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
  36. raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression);
  37. template <typename T>
  38. void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
  39. OS << "\n";
  40. OS.indent(Indent);
  41. OS << Name << ": " << Value;
  42. }
  43. } // end namespace pdb
  44. } // end namespace llvm
  45. #endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H