aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm14/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp
blob: c833103663e4fa602b5bc69d360c00c78235eee4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//===- DebugSymbolsSubsection.cpp -------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"

using namespace llvm;
using namespace llvm::codeview;

Error DebugSymbolsSubsectionRef::initialize(BinaryStreamReader Reader) {
  return Reader.readArray(Records, Reader.getLength());
}

uint32_t DebugSymbolsSubsection::calculateSerializedSize() const {
  return Length;
}

Error DebugSymbolsSubsection::commit(BinaryStreamWriter &Writer) const {
  for (const auto &Record : Records) {
    if (auto EC = Writer.writeBytes(Record.RecordData))
      return EC;
  }
  return Error::success();
}

void DebugSymbolsSubsection::addSymbol(CVSymbol Symbol) {
  Records.push_back(Symbol);
  Length += Symbol.length();
}