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