DebugCrossExSubsection.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //===- DebugCrossExSubsection.h ---------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
  9. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
  10. #include "llvm/DebugInfo/CodeView/CodeView.h"
  11. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  12. #include "llvm/Support/BinaryStreamArray.h"
  13. #include "llvm/Support/BinaryStreamReader.h"
  14. #include "llvm/Support/BinaryStreamRef.h"
  15. #include "llvm/Support/Error.h"
  16. #include <cstdint>
  17. #include <map>
  18. namespace llvm {
  19. namespace codeview {
  20. class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
  21. using ReferenceArray = FixedStreamArray<CrossModuleExport>;
  22. using Iterator = ReferenceArray::Iterator;
  23. public:
  24. DebugCrossModuleExportsSubsectionRef()
  25. : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {}
  26. static bool classof(const DebugSubsectionRef *S) {
  27. return S->kind() == DebugSubsectionKind::CrossScopeExports;
  28. }
  29. Error initialize(BinaryStreamReader Reader);
  30. Error initialize(BinaryStreamRef Stream);
  31. Iterator begin() const { return References.begin(); }
  32. Iterator end() const { return References.end(); }
  33. private:
  34. FixedStreamArray<CrossModuleExport> References;
  35. };
  36. class DebugCrossModuleExportsSubsection final : public DebugSubsection {
  37. public:
  38. DebugCrossModuleExportsSubsection()
  39. : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {}
  40. static bool classof(const DebugSubsection *S) {
  41. return S->kind() == DebugSubsectionKind::CrossScopeExports;
  42. }
  43. void addMapping(uint32_t Local, uint32_t Global);
  44. uint32_t calculateSerializedSize() const override;
  45. Error commit(BinaryStreamWriter &Writer) const override;
  46. private:
  47. std::map<uint32_t, uint32_t> Mappings;
  48. };
  49. } // end namespace codeview
  50. } // end namespace llvm
  51. #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H