PDBExtras.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
  14. #define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/DebugInfo/CodeView/CodeView.h"
  17. #include "llvm/DebugInfo/PDB/PDBTypes.h"
  18. #include "llvm/Support/raw_ostream.h"
  19. #include <cstdint>
  20. #include <unordered_map>
  21. namespace llvm {
  22. namespace pdb {
  23. using TagStats = std::unordered_map<PDB_SymType, int>;
  24. raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
  25. raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
  26. raw_ostream &operator<<(raw_ostream &OS, const PDB_BuiltinType &Type);
  27. raw_ostream &operator<<(raw_ostream &OS, const PDB_DataKind &Data);
  28. raw_ostream &operator<<(raw_ostream &OS,
  29. const llvm::codeview::CPURegister &CpuReg);
  30. raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
  31. raw_ostream &operator<<(raw_ostream &OS, const codeview::ThunkOrdinal &Thunk);
  32. raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
  33. raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
  34. raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
  35. raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access);
  36. raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
  37. raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
  38. raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
  39. raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
  40. raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
  41. raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression);
  42. template <typename T>
  43. void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
  44. OS << "\n";
  45. OS.indent(Indent);
  46. OS << Name << ": " << Value;
  47. }
  48. } // end namespace pdb
  49. } // end namespace llvm
  50. #endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
  51. #ifdef __GNUC__
  52. #pragma GCC diagnostic pop
  53. #endif