DebugSymbolsSubsection.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===- DebugSymbolsSubsection.cpp -------------------------------*- C++ -*-===//
  2. //
  3. // 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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
  9. #include "llvm/Support/BinaryStreamWriter.h"
  10. using namespace llvm;
  11. using namespace llvm::codeview;
  12. Error DebugSymbolsSubsectionRef::initialize(BinaryStreamReader Reader) {
  13. return Reader.readArray(Records, Reader.getLength());
  14. }
  15. uint32_t DebugSymbolsSubsection::calculateSerializedSize() const {
  16. return Length;
  17. }
  18. Error DebugSymbolsSubsection::commit(BinaryStreamWriter &Writer) const {
  19. for (const auto &Record : Records) {
  20. if (auto EC = Writer.writeBytes(Record.RecordData))
  21. return EC;
  22. }
  23. return Error::success();
  24. }
  25. void DebugSymbolsSubsection::addSymbol(CVSymbol Symbol) {
  26. Records.push_back(Symbol);
  27. Length += Symbol.length();
  28. }