xref: /netbsd-src/external/apache2/llvm/dist/llvm/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1*7330f729Sjoerg //===- DebugSymbolsSubsection.cpp -------------------------------*- C++ -*-===//
2*7330f729Sjoerg //
3*7330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*7330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
5*7330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*7330f729Sjoerg //
7*7330f729Sjoerg //===----------------------------------------------------------------------===//
8*7330f729Sjoerg 
9*7330f729Sjoerg #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
10*7330f729Sjoerg 
11*7330f729Sjoerg using namespace llvm;
12*7330f729Sjoerg using namespace llvm::codeview;
13*7330f729Sjoerg 
initialize(BinaryStreamReader Reader)14*7330f729Sjoerg Error DebugSymbolsSubsectionRef::initialize(BinaryStreamReader Reader) {
15*7330f729Sjoerg   return Reader.readArray(Records, Reader.getLength());
16*7330f729Sjoerg }
17*7330f729Sjoerg 
calculateSerializedSize() const18*7330f729Sjoerg uint32_t DebugSymbolsSubsection::calculateSerializedSize() const {
19*7330f729Sjoerg   return Length;
20*7330f729Sjoerg }
21*7330f729Sjoerg 
commit(BinaryStreamWriter & Writer) const22*7330f729Sjoerg Error DebugSymbolsSubsection::commit(BinaryStreamWriter &Writer) const {
23*7330f729Sjoerg   for (const auto &Record : Records) {
24*7330f729Sjoerg     if (auto EC = Writer.writeBytes(Record.RecordData))
25*7330f729Sjoerg       return EC;
26*7330f729Sjoerg   }
27*7330f729Sjoerg   return Error::success();
28*7330f729Sjoerg }
29*7330f729Sjoerg 
addSymbol(CVSymbol Symbol)30*7330f729Sjoerg void DebugSymbolsSubsection::addSymbol(CVSymbol Symbol) {
31*7330f729Sjoerg   Records.push_back(Symbol);
32*7330f729Sjoerg   Length += Symbol.length();
33*7330f729Sjoerg }
34