blob: a4c04b55eb4c2e1b6f2c3e58fc17bb4d08a7e5db [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- DebugSymbolRVASubsection.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_DEBUGSYMBOLRVASUBSECTION_H
11#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_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/Endian.h"
17#include "llvm/Support/Error.h"
18#include <cstdint>
19#include <vector>
20
21namespace llvm {
22
23class BinaryStreamReader;
24
25namespace codeview {
26
27class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
28public:
29 using ArrayType = FixedStreamArray<support::ulittle32_t>;
30
31 DebugSymbolRVASubsectionRef();
32
33 static bool classof(const DebugSubsectionRef *S) {
34 return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
35 }
36
37 ArrayType::Iterator begin() const { return RVAs.begin(); }
38 ArrayType::Iterator end() const { return RVAs.end(); }
39
40 Error initialize(BinaryStreamReader &Reader);
41
42private:
43 ArrayType RVAs;
44};
45
46class DebugSymbolRVASubsection final : public DebugSubsection {
47public:
48 DebugSymbolRVASubsection();
49
50 static bool classof(const DebugSubsection *S) {
51 return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
52 }
53
54 Error commit(BinaryStreamWriter &Writer) const override;
55 uint32_t calculateSerializedSize() const override;
56
57 void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); }
58
59private:
60 std::vector<support::ulittle32_t> RVAs;
61};
62
63} // end namespace codeview
64
65} // end namespace llvm
66
67#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H