SymbolStream.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //===- SymbolStream.cpp - PDB Symbol Stream Access ------------------------===//
  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/PDB/Native/SymbolStream.h"
  9. #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
  10. #include "llvm/Support/Endian.h"
  11. using namespace llvm;
  12. using namespace llvm::msf;
  13. using namespace llvm::support;
  14. using namespace llvm::pdb;
  15. SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
  16. : Stream(std::move(Stream)) {}
  17. SymbolStream::~SymbolStream() = default;
  18. Error SymbolStream::reload() {
  19. BinaryStreamReader Reader(*Stream);
  20. if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
  21. return EC;
  22. return Error::success();
  23. }
  24. iterator_range<codeview::CVSymbolArray::Iterator>
  25. SymbolStream::getSymbols(bool *HadError) const {
  26. return llvm::make_range(SymbolRecords.begin(HadError), SymbolRecords.end());
  27. }
  28. Error SymbolStream::commit() { return Error::success(); }
  29. codeview::CVSymbol SymbolStream::readRecord(uint32_t Offset) const {
  30. return *SymbolRecords.at(Offset);
  31. }