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