diff options
author | Zachary Turner <zturner@google.com> | 2016-07-28 19:12:28 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-07-28 19:12:28 +0000 |
commit | d66889cbae749ceffca88f094274e2d64c2cb8f8 (patch) | |
tree | 81e34f9af216751ced0d50609d558d2f15277b46 /llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp | |
parent | 199f48a5f0d5aee8737880a78d81216d60cf785d (diff) | |
download | llvm-d66889cbae749ceffca88f094274e2d64c2cb8f8.zip llvm-d66889cbae749ceffca88f094274e2d64c2cb8f8.tar.gz llvm-d66889cbae749ceffca88f094274e2d64c2cb8f8.tar.bz2 |
[pdb] Refactor library to more clearly separate reading/writing
Reviewed By: amccarth, ruiu
Differential Revision: https://reviews.llvm.org/D22693
llvm-svn: 277019
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp b/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp index e6d915f..a83689f 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp @@ -26,21 +26,6 @@ using namespace llvm; using namespace llvm::msf; using namespace llvm::pdb; -namespace { -// We need a class which behaves like an immutable ByteStream, but whose data -// is backed by an llvm::MemoryBuffer. It also needs to own the underlying -// MemoryBuffer, so this simple adapter is a good way to achieve that. -class InputByteStream : public ByteStream<false> { -public: - explicit InputByteStream(std::unique_ptr<MemoryBuffer> Buffer) - : ByteStream(ArrayRef<uint8_t>(Buffer->getBuffer().bytes_begin(), - Buffer->getBuffer().bytes_end())), - MemBuffer(std::move(Buffer)) {} - - std::unique_ptr<MemoryBuffer> MemBuffer; -}; -} - RawSession::RawSession(std::unique_ptr<PDBFile> PdbFile, std::unique_ptr<BumpPtrAllocator> Allocator) : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)) {} @@ -57,7 +42,7 @@ Error RawSession::createFromPdb(StringRef Path, return llvm::make_error<GenericError>(generic_error_code::invalid_path); std::unique_ptr<MemoryBuffer> Buffer = std::move(*ErrorOrBuffer); - auto Stream = llvm::make_unique<InputByteStream>(std::move(Buffer)); + auto Stream = llvm::make_unique<MemoryBufferByteStream>(std::move(Buffer)); auto Allocator = llvm::make_unique<BumpPtrAllocator>(); auto File = llvm::make_unique<PDBFile>(std::move(Stream), *Allocator); |