1 //===- DebugSymbolsSubsection.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_DEBUGSYMBOLSSUBSECTION_H
11 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
12 
13 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
14 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
15 #include "llvm/Support/Error.h"
16 
17 namespace llvm {
18 namespace codeview {
19 class DebugSymbolsSubsectionRef final : public DebugSubsectionRef {
20 public:
DebugSymbolsSubsectionRef()21   DebugSymbolsSubsectionRef()
22       : DebugSubsectionRef(DebugSubsectionKind::Symbols) {}
23 
classof(const DebugSubsectionRef * S)24   static bool classof(const DebugSubsectionRef *S) {
25     return S->kind() == DebugSubsectionKind::Symbols;
26   }
27 
28   Error initialize(BinaryStreamReader Reader);
29 
begin()30   CVSymbolArray::Iterator begin() const { return Records.begin(); }
end()31   CVSymbolArray::Iterator end() const { return Records.end(); }
32 
33 private:
34   CVSymbolArray Records;
35 };
36 
37 class DebugSymbolsSubsection final : public DebugSubsection {
38 public:
DebugSymbolsSubsection()39   DebugSymbolsSubsection() : DebugSubsection(DebugSubsectionKind::Symbols) {}
classof(const DebugSubsection * S)40   static bool classof(const DebugSubsection *S) {
41     return S->kind() == DebugSubsectionKind::Symbols;
42   }
43 
44   uint32_t calculateSerializedSize() const override;
45   Error commit(BinaryStreamWriter &Writer) const override;
46 
47   void addSymbol(CVSymbol Symbol);
48 
49 private:
50   uint32_t Length = 0;
51   std::vector<CVSymbol> Records;
52 };
53 }
54 }
55 
56 #endif
57