blob: 52328967357b02801f11c3339f79aec0bef524ce [file] [log] [blame]
Eugene Zelenko8456b162017-06-29 00:05:44 +00001//===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
Zachary Turner3226fe92017-06-09 20:46:52 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Zachary Turner3226fe92017-06-09 20:46:52 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
Eugene Zelenko8456b162017-06-29 00:05:44 +000010#include "llvm/ADT/ArrayRef.h"
11#include "llvm/DebugInfo/CodeView/CodeView.h"
12#include "llvm/Support/BinaryStreamReader.h"
13#include "llvm/Support/BinaryStreamWriter.h"
14#include <cstdint>
Zachary Turner3226fe92017-06-09 20:46:52 +000015
16using namespace llvm;
17using namespace llvm::codeview;
18
19DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
20 : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
21
22Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
23 return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
24}
25
26DebugSymbolRVASubsection::DebugSymbolRVASubsection()
27 : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
28
29Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
30 return Writer.writeArray(makeArrayRef(RVAs));
31}
32
33uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
34 return RVAs.size() * sizeof(uint32_t);
35}