xref: /freebsd/contrib/llvm-project/llvm/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===- DebugSymbolsSubsection.h --------------------------------*- C++ -*-===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
10 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
11 
12 #include "llvm/DebugInfo/CodeView/CVRecord.h"
13 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
14 #include "llvm/Support/Compiler.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   LLVM_ABI 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 LLVM_ABI 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