DbiModuleDescriptor.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DbiModuleDescriptor.h - PDB module information -----------*- 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_NATIVE_DBIMODULEDESCRIPTOR_H
  14. #define LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULEDESCRIPTOR_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/Support/BinaryStreamRef.h"
  17. #include "llvm/Support/Error.h"
  18. #include <cstdint>
  19. namespace llvm {
  20. template <typename T> struct VarStreamArrayExtractor;
  21. namespace pdb {
  22. struct ModuleInfoHeader;
  23. struct SectionContrib;
  24. class DbiModuleDescriptor {
  25. friend class DbiStreamBuilder;
  26. public:
  27. DbiModuleDescriptor() = default;
  28. DbiModuleDescriptor(const DbiModuleDescriptor &Info) = default;
  29. DbiModuleDescriptor &operator=(const DbiModuleDescriptor &Info) = default;
  30. static Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info);
  31. bool hasECInfo() const;
  32. uint16_t getTypeServerIndex() const;
  33. uint16_t getModuleStreamIndex() const;
  34. uint32_t getSymbolDebugInfoByteSize() const;
  35. uint32_t getC11LineInfoByteSize() const;
  36. uint32_t getC13LineInfoByteSize() const;
  37. uint32_t getNumberOfFiles() const;
  38. uint32_t getSourceFileNameIndex() const;
  39. uint32_t getPdbFilePathNameIndex() const;
  40. StringRef getModuleName() const;
  41. StringRef getObjFileName() const;
  42. uint32_t getRecordLength() const;
  43. const SectionContrib &getSectionContrib() const;
  44. private:
  45. StringRef ModuleName;
  46. StringRef ObjFileName;
  47. const ModuleInfoHeader *Layout = nullptr;
  48. };
  49. } // end namespace pdb
  50. template <> struct VarStreamArrayExtractor<pdb::DbiModuleDescriptor> {
  51. Error operator()(BinaryStreamRef Stream, uint32_t &Length,
  52. pdb::DbiModuleDescriptor &Info) {
  53. if (auto EC = pdb::DbiModuleDescriptor::initialize(Stream, Info))
  54. return EC;
  55. Length = Info.getRecordLength();
  56. return Error::success();
  57. }
  58. };
  59. } // end namespace llvm
  60. #endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULEDESCRIPTOR_H
  61. #ifdef __GNUC__
  62. #pragma GCC diagnostic pop
  63. #endif