DebugCrossExSubsection.h 2.3 KB

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