10b57cec5SDimitry Andric //===- DebugSymbolsSubsection.h --------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
100b57cec5SDimitry Andric #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLSSUBSECTION_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CVRecord.h"
130b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
140b57cec5SDimitry Andric #include "llvm/Support/Error.h"
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric namespace llvm {
170b57cec5SDimitry Andric namespace codeview {
180b57cec5SDimitry Andric class DebugSymbolsSubsectionRef final : public DebugSubsectionRef {
190b57cec5SDimitry Andric public:
DebugSymbolsSubsectionRef()200b57cec5SDimitry Andric   DebugSymbolsSubsectionRef()
210b57cec5SDimitry Andric       : DebugSubsectionRef(DebugSubsectionKind::Symbols) {}
220b57cec5SDimitry Andric 
classof(const DebugSubsectionRef * S)230b57cec5SDimitry Andric   static bool classof(const DebugSubsectionRef *S) {
240b57cec5SDimitry Andric     return S->kind() == DebugSubsectionKind::Symbols;
250b57cec5SDimitry Andric   }
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric   Error initialize(BinaryStreamReader Reader);
280b57cec5SDimitry Andric 
begin()290b57cec5SDimitry Andric   CVSymbolArray::Iterator begin() const { return Records.begin(); }
end()300b57cec5SDimitry Andric   CVSymbolArray::Iterator end() const { return Records.end(); }
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric private:
330b57cec5SDimitry Andric   CVSymbolArray Records;
340b57cec5SDimitry Andric };
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric class DebugSymbolsSubsection final : public DebugSubsection {
370b57cec5SDimitry Andric public:
DebugSymbolsSubsection()380b57cec5SDimitry Andric   DebugSymbolsSubsection() : DebugSubsection(DebugSubsectionKind::Symbols) {}
classof(const DebugSubsection * S)390b57cec5SDimitry Andric   static bool classof(const DebugSubsection *S) {
400b57cec5SDimitry Andric     return S->kind() == DebugSubsectionKind::Symbols;
410b57cec5SDimitry Andric   }
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric   uint32_t calculateSerializedSize() const override;
440b57cec5SDimitry Andric   Error commit(BinaryStreamWriter &Writer) const override;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   void addSymbol(CVSymbol Symbol);
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric private:
490b57cec5SDimitry Andric   uint32_t Length = 0;
500b57cec5SDimitry Andric   std::vector<CVSymbol> Records;
510b57cec5SDimitry Andric };
520b57cec5SDimitry Andric }
530b57cec5SDimitry Andric }
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric #endif
56