xref: /llvm-project/llvm/lib/DebugInfo/CodeView/DebugSymbolRVASubsection.cpp (revision 3226fe95bbb8b6bcc477ce7ec4f158a20669694d)
1 //===- DebugSymbolRVASubsection.cpp ------------------------------*- C++-*-===//
2 //
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"
11 
12 using namespace llvm;
13 using namespace llvm::codeview;
14 
15 DebugSymbolRVASubsectionRef::DebugSymbolRVASubsectionRef()
16     : DebugSubsectionRef(DebugSubsectionKind::CoffSymbolRVA) {}
17 
18 Error DebugSymbolRVASubsectionRef::initialize(BinaryStreamReader &Reader) {
19   return Reader.readArray(RVAs, Reader.bytesRemaining() / sizeof(uint32_t));
20 }
21 
22 DebugSymbolRVASubsection::DebugSymbolRVASubsection()
23     : DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
24 
25 Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
26   return Writer.writeArray(makeArrayRef(RVAs));
27 }
28 
29 uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {
30   return RVAs.size() * sizeof(uint32_t);
31 }
32