• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- 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 
21 namespace llvm {
22 
23 class BinaryStreamReader;
24 
25 namespace codeview {
26 
27 class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
28 public:
29   using ArrayType = FixedStreamArray<support::ulittle32_t>;
30 
31   DebugSymbolRVASubsectionRef();
32 
classof(const DebugSubsectionRef * S)33   static bool classof(const DebugSubsectionRef *S) {
34     return S->kind() == DebugSubsectionKind::CoffSymbolRVA;
35   }
36 
begin()37   ArrayType::Iterator begin() const { return RVAs.begin(); }
end()38   ArrayType::Iterator end() const { return RVAs.end(); }
39 
40   Error initialize(BinaryStreamReader &Reader);
41 
42 private:
43   ArrayType RVAs;
44 };
45 
46 class DebugSymbolRVASubsection final : public DebugSubsection {
47 public:
48   DebugSymbolRVASubsection();
49 
classof(const DebugSubsection * S)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 
addRVA(uint32_t RVA)57   void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); }
58 
59 private:
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
68