blob: 2f9e9814d998d5000f43effa90958459282d03ad [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- 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
22namespace llvm {
23namespace codeview {
24
25class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
26 using ReferenceArray = FixedStreamArray<CrossModuleExport>;
27 using Iterator = ReferenceArray::Iterator;
28
29public:
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
43private:
44 FixedStreamArray<CrossModuleExport> References;
45};
46
47class DebugCrossModuleExportsSubsection final : public DebugSubsection {
48public:
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
61private:
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