aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm16/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp
blob: 2b20b3e95db6fe5f47cb4820a3cf461fc0299858 (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
34
//===- 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"
#include "llvm/Support/BinaryStreamWriter.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();
}