xref: /src/contrib/llvm-project/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
19df3605dSDimitry Andric //===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
27ab83427SDimitry Andric //
3e6d15924SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e6d15924SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5e6d15924SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67ab83427SDimitry Andric //
77ab83427SDimitry Andric //===----------------------------------------------------------------------===//
87ab83427SDimitry Andric 
97ab83427SDimitry Andric #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
109df3605dSDimitry Andric #include "llvm/ADT/ArrayRef.h"
119df3605dSDimitry Andric #include "llvm/DebugInfo/CodeView/CodeView.h"
129df3605dSDimitry Andric #include "llvm/Support/BinaryStreamReader.h"
139df3605dSDimitry Andric #include "llvm/Support/BinaryStreamWriter.h"
149df3605dSDimitry Andric #include <cstdint>
157ab83427SDimitry Andric 
167ab83427SDimitry Andric using namespace llvm;
177ab83427SDimitry Andric using namespace llvm::codeview;
187ab83427SDimitry Andric 
DebugSymbolRVASubsectionRef()197ab83427SDimitry Andric DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
207ab83427SDimitry Andric     : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
217ab83427SDimitry Andric 
initialize(BinaryStreamReader & Reader)227ab83427SDimitry Andric Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
237ab83427SDimitry Andric   return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
247ab83427SDimitry Andric }
257ab83427SDimitry Andric 
DebugSymbolRVASubsection()267ab83427SDimitry Andric DebugSymbolRVASubsection::DebugSymbolRVASubsection()
277ab83427SDimitry Andric     : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
287ab83427SDimitry Andric 
commit(BinaryStreamWriter & Writer) const297ab83427SDimitry Andric Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
30e3b55780SDimitry Andric   return Writer.writeArray(ArrayRef(RVAs));
317ab83427SDimitry Andric }
327ab83427SDimitry Andric 
calculateSerializedSize() const337ab83427SDimitry Andric uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
347ab83427SDimitry Andric   return RVAs.size() * sizeof(uint32_t);
357ab83427SDimitry Andric }
36