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 | |
9 | #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H |
10 | #define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H |
11 | |
12 | #include "llvm/DebugInfo/CodeView/CodeView.h" |
13 | #include "llvm/DebugInfo/CodeView/DebugSubsection.h" |
14 | #include "llvm/Support/BinaryStreamArray.h" |
15 | #include "llvm/Support/BinaryStreamRef.h" |
16 | #include "llvm/Support/Error.h" |
17 | #include <cstdint> |
18 | #include <map> |
19 | |
20 | namespace llvm { |
21 | class BinaryStreamReader; |
22 | class BinaryStreamWriter; |
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 |
69 |