1*0b57cec5SDimitry Andric //===- DebugSymbolRVASubsection.h -------------------------------*- C++ -*-===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H 10*0b57cec5SDimitry Andric #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H 11*0b57cec5SDimitry Andric 12*0b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CodeView.h" 13*0b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/DebugSubsection.h" 14*0b57cec5SDimitry Andric #include "llvm/Support/BinaryStreamArray.h" 15*0b57cec5SDimitry Andric #include "llvm/Support/Endian.h" 16*0b57cec5SDimitry Andric #include "llvm/Support/Error.h" 17*0b57cec5SDimitry Andric #include <cstdint> 18*0b57cec5SDimitry Andric #include <vector> 19*0b57cec5SDimitry Andric 20*0b57cec5SDimitry Andric namespace llvm { 21*0b57cec5SDimitry Andric 22*0b57cec5SDimitry Andric class BinaryStreamReader; 23*0b57cec5SDimitry Andric 24*0b57cec5SDimitry Andric namespace codeview { 25*0b57cec5SDimitry Andric 26*0b57cec5SDimitry Andric class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef { 27*0b57cec5SDimitry Andric public: 28*0b57cec5SDimitry Andric using ArrayType = FixedStreamArray<support::ulittle32_t>; 29*0b57cec5SDimitry Andric 30*0b57cec5SDimitry Andric DebugSymbolRVASubsectionRef(); 31*0b57cec5SDimitry Andric classof(const DebugSubsectionRef * S)32*0b57cec5SDimitry Andric static bool classof(const DebugSubsectionRef *S) { 33*0b57cec5SDimitry Andric return S->kind() == DebugSubsectionKind::CoffSymbolRVA; 34*0b57cec5SDimitry Andric } 35*0b57cec5SDimitry Andric begin()36*0b57cec5SDimitry Andric ArrayType::Iterator begin() const { return RVAs.begin(); } end()37*0b57cec5SDimitry Andric ArrayType::Iterator end() const { return RVAs.end(); } 38*0b57cec5SDimitry Andric 39*0b57cec5SDimitry Andric Error initialize(BinaryStreamReader &Reader); 40*0b57cec5SDimitry Andric 41*0b57cec5SDimitry Andric private: 42*0b57cec5SDimitry Andric ArrayType RVAs; 43*0b57cec5SDimitry Andric }; 44*0b57cec5SDimitry Andric 45*0b57cec5SDimitry Andric class DebugSymbolRVASubsection final : public DebugSubsection { 46*0b57cec5SDimitry Andric public: 47*0b57cec5SDimitry Andric DebugSymbolRVASubsection(); 48*0b57cec5SDimitry Andric classof(const DebugSubsection * S)49*0b57cec5SDimitry Andric static bool classof(const DebugSubsection *S) { 50*0b57cec5SDimitry Andric return S->kind() == DebugSubsectionKind::CoffSymbolRVA; 51*0b57cec5SDimitry Andric } 52*0b57cec5SDimitry Andric 53*0b57cec5SDimitry Andric Error commit(BinaryStreamWriter &Writer) const override; 54*0b57cec5SDimitry Andric uint32_t calculateSerializedSize() const override; 55*0b57cec5SDimitry Andric addRVA(uint32_t RVA)56*0b57cec5SDimitry Andric void addRVA(uint32_t RVA) { RVAs.push_back(support::ulittle32_t(RVA)); } 57*0b57cec5SDimitry Andric 58*0b57cec5SDimitry Andric private: 59*0b57cec5SDimitry Andric std::vector<support::ulittle32_t> RVAs; 60*0b57cec5SDimitry Andric }; 61*0b57cec5SDimitry Andric 62*0b57cec5SDimitry Andric } // end namespace codeview 63*0b57cec5SDimitry Andric 64*0b57cec5SDimitry Andric } // end namespace llvm 65*0b57cec5SDimitry Andric 66*0b57cec5SDimitry Andric #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H 67