1 //===- DebugCrossExSubsection.h ---------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H 11 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H 12 13 #include "llvm/DebugInfo/CodeView/DebugSubsection.h" 14 #include "llvm/Support/BinaryStreamArray.h" 15 #include "llvm/Support/BinaryStreamReader.h" 16 #include "llvm/Support/Endian.h" 17 18 #include <map> 19 20 namespace llvm { 21 namespace codeview { 22 class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef { 23 typedef FixedStreamArray<CrossModuleExport> ReferenceArray; 24 typedef ReferenceArray::Iterator Iterator; 25 26 public: 27 DebugCrossModuleExportsSubsectionRef() 28 : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {} 29 30 static bool classof(const DebugSubsectionRef *S) { 31 return S->kind() == DebugSubsectionKind::CrossScopeExports; 32 } 33 34 Error initialize(BinaryStreamReader Reader); 35 Error initialize(BinaryStreamRef Stream); 36 37 Iterator begin() const { return References.begin(); } 38 Iterator end() const { return References.end(); } 39 40 private: 41 FixedStreamArray<CrossModuleExport> References; 42 }; 43 44 class DebugCrossModuleExportsSubsection final : public DebugSubsection { 45 public: 46 DebugCrossModuleExportsSubsection() 47 : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {} 48 49 static bool classof(const DebugSubsection *S) { 50 return S->kind() == DebugSubsectionKind::CrossScopeExports; 51 } 52 53 void addMapping(uint32_t Local, uint32_t Global); 54 55 uint32_t calculateSerializedSize() const override; 56 Error commit(BinaryStreamWriter &Writer) const override; 57 58 private: 59 std::map<uint32_t, uint32_t> Mappings; 60 }; 61 } 62 } 63 64 #endif 65