blob: 60fbf9d747b289775d378ef0380f7d19a7ef04fc [file] [log] [blame]
Eugene Zelenko8456b162017-06-29 00:05:44 +00001//===- DebugSymbolRVASubsection.cpp ---------------------------------------===//
Zachary Turner3226fe92017-06-09 20:46:52 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"
Eugene Zelenko8456b162017-06-29 00:05:44 +000011#include "llvm/ADT/ArrayRef.h"
12#include "llvm/DebugInfo/CodeView/CodeView.h"
13#include "llvm/Support/BinaryStreamReader.h"
14#include "llvm/Support/BinaryStreamWriter.h"
15#include <cstdint>
Zachary Turner3226fe92017-06-09 20:46:52 +000016
17using namespace llvm;
18using namespace llvm::codeview;
19
20DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
21 : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
22
23Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
24 return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
25}
26
27DebugSymbolRVASubsection::DebugSymbolRVASubsection()
28 : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
29
30Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
31 return Writer.writeArray(makeArrayRef(RVAs));
32}
33
34uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
35 return RVAs.size() * sizeof(uint32_t);
36}