Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame^] | 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/CodeView.h" |
| 14 | #include "llvm/DebugInfo/CodeView/DebugSubsection.h" |
| 15 | #include "llvm/Support/BinaryStreamArray.h" |
| 16 | #include "llvm/Support/BinaryStreamReader.h" |
| 17 | #include "llvm/Support/BinaryStreamRef.h" |
| 18 | #include "llvm/Support/Error.h" |
| 19 | #include <cstdint> |
| 20 | #include <map> |
| 21 | |
| 22 | namespace llvm { |
| 23 | namespace codeview { |
| 24 | |
| 25 | class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef { |
| 26 | using ReferenceArray = FixedStreamArray<CrossModuleExport>; |
| 27 | using Iterator = ReferenceArray::Iterator; |
| 28 | |
| 29 | public: |
| 30 | DebugCrossModuleExportsSubsectionRef() |
| 31 | : DebugSubsectionRef(DebugSubsectionKind::CrossScopeExports) {} |
| 32 | |
| 33 | static bool classof(const DebugSubsectionRef *S) { |
| 34 | return S->kind() == DebugSubsectionKind::CrossScopeExports; |
| 35 | } |
| 36 | |
| 37 | Error initialize(BinaryStreamReader Reader); |
| 38 | Error initialize(BinaryStreamRef Stream); |
| 39 | |
| 40 | Iterator begin() const { return References.begin(); } |
| 41 | Iterator end() const { return References.end(); } |
| 42 | |
| 43 | private: |
| 44 | FixedStreamArray<CrossModuleExport> References; |
| 45 | }; |
| 46 | |
| 47 | class DebugCrossModuleExportsSubsection final : public DebugSubsection { |
| 48 | public: |
| 49 | DebugCrossModuleExportsSubsection() |
| 50 | : DebugSubsection(DebugSubsectionKind::CrossScopeExports) {} |
| 51 | |
| 52 | static bool classof(const DebugSubsection *S) { |
| 53 | return S->kind() == DebugSubsectionKind::CrossScopeExports; |
| 54 | } |
| 55 | |
| 56 | void addMapping(uint32_t Local, uint32_t Global); |
| 57 | |
| 58 | uint32_t calculateSerializedSize() const override; |
| 59 | Error commit(BinaryStreamWriter &Writer) const override; |
| 60 | |
| 61 | private: |
| 62 | std::map<uint32_t, uint32_t> Mappings; |
| 63 | }; |
| 64 | |
| 65 | } // end namespace codeview |
| 66 | } // end namespace llvm |
| 67 | |
| 68 | #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H |