10b57cec5SDimitry Andric //===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
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 #include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
100b57cec5SDimitry Andric #include "llvm/ADT/ArrayRef.h"
110b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CodeView.h"
120b57cec5SDimitry Andric #include "llvm/Support/BinaryStreamReader.h"
130b57cec5SDimitry Andric #include "llvm/Support/BinaryStreamWriter.h"
140b57cec5SDimitry Andric #include <cstdint>
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric using namespace llvm;
170b57cec5SDimitry Andric using namespace llvm::codeview;
180b57cec5SDimitry Andric 
DebugSymbolRVASubsectionRef()190b57cec5SDimitry Andric DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
200b57cec5SDimitry Andric     : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
210b57cec5SDimitry Andric 
initialize(BinaryStreamReader & Reader)220b57cec5SDimitry Andric Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
230b57cec5SDimitry Andric   return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
240b57cec5SDimitry Andric }
250b57cec5SDimitry Andric 
DebugSymbolRVASubsection()260b57cec5SDimitry Andric DebugSymbolRVASubsection::DebugSymbolRVASubsection()
270b57cec5SDimitry Andric     : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
280b57cec5SDimitry Andric 
commit(BinaryStreamWriter & Writer) const290b57cec5SDimitry Andric Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
30bdd1243dSDimitry Andric   return Writer.writeArray(ArrayRef(RVAs));
310b57cec5SDimitry Andric }
320b57cec5SDimitry Andric 
calculateSerializedSize() const330b57cec5SDimitry Andric uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
340b57cec5SDimitry Andric   return RVAs.size() * sizeof(uint32_t);
350b57cec5SDimitry Andric }
36