diff options
author | Zachary Turner <zturner@google.com> | 2016-07-22 19:56:26 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-07-22 19:56:26 +0000 |
commit | e109dc63f95eae32772335d131935b073594a7ce (patch) | |
tree | 73bc246d8e63f5b9e692e5ec87d157a804926878 /llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp | |
parent | bac69d33d013a86277cf2acb9809819e1623c732 (diff) | |
download | llvm-e109dc63f95eae32772335d131935b073594a7ce.zip llvm-e109dc63f95eae32772335d131935b073594a7ce.tar.gz llvm-e109dc63f95eae32772335d131935b073594a7ce.tar.bz2 |
[pdb] Have builders share a single BumpPtrAllocator.
This makes it easier to have the writable and readable PDB
interfaces share code since the read/write and write-only
interfaces now share a single allocator, you don't have to worry
about a builder building a read only interface and then having
the read-only interface's data become corrupt when the builder
goes out of scope. Now the allocator is specified explicitly
to all constructors, so all interfaces can share a single allocator
that is scoped appropriately.
llvm-svn: 276459
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp b/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp index e734aeb..e6d915f 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/RawSession.cpp @@ -41,8 +41,9 @@ public: }; } -RawSession::RawSession(std::unique_ptr<PDBFile> PdbFile) - : Pdb(std::move(PdbFile)) {} +RawSession::RawSession(std::unique_ptr<PDBFile> PdbFile, + std::unique_ptr<BumpPtrAllocator> Allocator) + : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)) {} RawSession::~RawSession() {} @@ -58,13 +59,15 @@ Error RawSession::createFromPdb(StringRef Path, std::unique_ptr<MemoryBuffer> Buffer = std::move(*ErrorOrBuffer); auto Stream = llvm::make_unique<InputByteStream>(std::move(Buffer)); - std::unique_ptr<PDBFile> File(new PDBFile(std::move(Stream))); + auto Allocator = llvm::make_unique<BumpPtrAllocator>(); + auto File = llvm::make_unique<PDBFile>(std::move(Stream), *Allocator); if (auto EC = File->parseFileHeaders()) return EC; if (auto EC = File->parseStreamData()) return EC; - Session.reset(new RawSession(std::move(File))); + Session = + llvm::make_unique<RawSession>(std::move(File), std::move(Allocator)); return Error::success(); } |