blob: 51b8523ed9697029d5a49f75e05c6d625c9537a4 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- DebugSymbolsSubsection.h --------------------------------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
10#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
11
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020012#include "llvm/DebugInfo/CodeView/CVRecord.h"
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010013#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010014#include "llvm/Support/Error.h"
15
16namespace llvm {
17namespace codeview {
18class DebugSymbolsSubsectionRef final : public DebugSubsectionRef {
19public:
20 DebugSymbolsSubsectionRef()
21 : DebugSubsectionRef(DebugSubsectionKind::Symbols) {}
22
23 static bool classof(const DebugSubsectionRef *S) {
24 return S->kind() == DebugSubsectionKind::Symbols;
25 }
26
27 Error initialize(BinaryStreamReader Reader);
28
29 CVSymbolArray::Iterator begin() const { return Records.begin(); }
30 CVSymbolArray::Iterator end() const { return Records.end(); }
31
32private:
33 CVSymbolArray Records;
34};
35
36class DebugSymbolsSubsection final : public DebugSubsection {
37public:
38 DebugSymbolsSubsection() : DebugSubsection(DebugSubsectionKind::Symbols) {}
39 static bool classof(const DebugSubsection *S) {
40 return S->kind() == DebugSubsectionKind::Symbols;
41 }
42
43 uint32_t calculateSerializedSize() const override;
44 Error commit(BinaryStreamWriter &Writer) const override;
45
46 void addSymbol(CVSymbol Symbol);
47
48private:
49 uint32_t Length = 0;
50 std::vector<CVSymbol> Records;
51};
52}
53}
54
55#endif