10b57cec5SDimitry Andric //===- DebugCrossExSubsection.h ---------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H 100b57cec5SDimitry Andric #define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CodeView.h" 130b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/DebugSubsection.h" 140b57cec5SDimitry Andric #include "llvm/Support/BinaryStreamArray.h" 150b57cec5SDimitry Andric #include "llvm/Support/BinaryStreamRef.h" 160b57cec5SDimitry Andric #include "llvm/Support/Error.h" 170b57cec5SDimitry Andric #include <cstdint> 180b57cec5SDimitry Andric #include <map> 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric namespace llvm { 2181ad6265SDimitry Andric class BinaryStreamReader; 2281ad6265SDimitry Andric class BinaryStreamWriter; 230b57cec5SDimitry Andric namespace codeview { 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef { 260b57cec5SDimitry Andric using ReferenceArray = FixedStreamArray<CrossModuleExport>; 270b57cec5SDimitry Andric using Iterator = ReferenceArray::Iterator; 280b57cec5SDimitry Andric 290b57cec5SDimitry Andric public: DebugCrossModuleExportsSubsectionRef()300b57cec5SDimitry Andric DebugCrossModuleExportsSubsectionRef() 310b57cec5SDimitry Andric : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {} 320b57cec5SDimitry Andric classof(const DebugSubsectionRef * S)330b57cec5SDimitry Andric static bool classof(const DebugSubsectionRef *S) { 340b57cec5SDimitry Andric return S->kind() == DebugSubsectionKind::CrossScopeExports; 350b57cec5SDimitry Andric } 360b57cec5SDimitry Andric 370b57cec5SDimitry Andric Error initialize(BinaryStreamReader Reader); 380b57cec5SDimitry Andric Error initialize(BinaryStreamRef Stream); 390b57cec5SDimitry Andric begin()400b57cec5SDimitry Andric Iterator begin() const { return References.begin(); } end()410b57cec5SDimitry Andric Iterator end() const { return References.end(); } 420b57cec5SDimitry Andric 430b57cec5SDimitry Andric private: 440b57cec5SDimitry Andric FixedStreamArray<CrossModuleExport> References; 450b57cec5SDimitry Andric }; 460b57cec5SDimitry Andric 470b57cec5SDimitry Andric class DebugCrossModuleExportsSubsection final : public DebugSubsection { 480b57cec5SDimitry Andric public: DebugCrossModuleExportsSubsection()490b57cec5SDimitry Andric DebugCrossModuleExportsSubsection() 500b57cec5SDimitry Andric : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {} 510b57cec5SDimitry Andric classof(const DebugSubsection * S)520b57cec5SDimitry Andric static bool classof(const DebugSubsection *S) { 530b57cec5SDimitry Andric return S->kind() == DebugSubsectionKind::CrossScopeExports; 540b57cec5SDimitry Andric } 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric void addMapping(uint32_t Local, uint32_t Global); 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric uint32_t calculateSerializedSize() const override; 590b57cec5SDimitry Andric Error commit(BinaryStreamWriter &Writer) const override; 600b57cec5SDimitry Andric 610b57cec5SDimitry Andric private: 620b57cec5SDimitry Andric std::map<uint32_t, uint32_t> Mappings; 630b57cec5SDimitry Andric }; 640b57cec5SDimitry Andric 650b57cec5SDimitry Andric } // end namespace codeview 660b57cec5SDimitry Andric } // end namespace llvm 670b57cec5SDimitry Andric 680b57cec5SDimitry Andric #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H 69