DebugCrossExSubsection.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DebugCrossExSubsection.h ---------------------------------*- 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_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
  15. #include "llvm/DebugInfo/CodeView/CodeView.h"
  16. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  17. #include "llvm/Support/BinaryStreamArray.h"
  18. #include "llvm/Support/BinaryStreamRef.h"
  19. #include "llvm/Support/Error.h"
  20. #include <cstdint>
  21. #include <map>
  22. namespace llvm {
  23. class BinaryStreamReader;
  24. class BinaryStreamWriter;
  25. namespace codeview {
  26. class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
  27. using ReferenceArray = FixedStreamArray<CrossModuleExport>;
  28. using Iterator = ReferenceArray::Iterator;
  29. public:
  30. DebugCrossModuleExportsSubsectionRef()
  31. : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {}
  32. static bool classof(const DebugSubsectionRef *S) {
  33. return S->kind() == DebugSubsectionKind::CrossScopeExports;
  34. }
  35. Error initialize(BinaryStreamReader Reader);
  36. Error initialize(BinaryStreamRef Stream);
  37. Iterator begin() const { return References.begin(); }
  38. Iterator end() const { return References.end(); }
  39. private:
  40. FixedStreamArray<CrossModuleExport> References;
  41. };
  42. class DebugCrossModuleExportsSubsection final : public DebugSubsection {
  43. public:
  44. DebugCrossModuleExportsSubsection()
  45. : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {}
  46. static bool classof(const DebugSubsection *S) {
  47. return S->kind() == DebugSubsectionKind::CrossScopeExports;
  48. }
  49. void addMapping(uint32_t Local, uint32_t Global);
  50. uint32_t calculateSerializedSize() const override;
  51. Error commit(BinaryStreamWriter &Writer) const override;
  52. private:
  53. std::map<uint32_t, uint32_t> Mappings;
  54. };
  55. } // end namespace codeview
  56. } // end namespace llvm
  57. #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
  58. #ifdef __GNUC__
  59. #pragma GCC diagnostic pop
  60. #endif