blob: 060eed7eafa0e1ad97a17bbf357e518611e781d5 [file] [log] [blame]
Zachary Turner591312c2017-05-30 17:13:33 +00001//===- DebugSymbolsSubsection.cpp -------------------------------*- C++ -*-===//
2//
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 Turner591312c2017-05-30 17:13:33 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
10
11using namespace llvm;
12using namespace llvm::codeview;
13
14Error DebugSymbolsSubsectionRef::initialize(BinaryStreamReader Reader) {
15 return Reader.readArray(Records, Reader.getLength());
16}
17
18uint32_t DebugSymbolsSubsection::calculateSerializedSize() const {
19 return Length;
20}
21
22Error DebugSymbolsSubsection::commit(BinaryStreamWriter &Writer) const {
23 for (const auto &Record : Records) {
24 if (auto EC = Writer.writeBytes(Record.RecordData))
25 return EC;
26 }
27 return Error::success();
28}
29
30void DebugSymbolsSubsection::addSymbol(CVSymbol Symbol) {
31 Records.push_back(Symbol);
32 Length += Symbol.length();
33}