diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp index c6bcd5106ca..6312cc25dba 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp @@ -26,12 +26,12 @@ using namespace llvm::msf; using namespace llvm::pdb; using namespace llvm::support; -PDBFileBuilder::PDBFileBuilder(std::unique_ptr<msf::StreamInterface> FileBuffer) - : File(llvm::make_unique<PDBFile>(std::move(FileBuffer))) {} +PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator) + : Allocator(Allocator) {} Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) { auto ExpectedMsf = - MsfBuilder::create(File->Allocator, Super.BlockSize, Super.NumBlocks); + MsfBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks); if (!ExpectedMsf) return ExpectedMsf.takeError(); @@ -54,11 +54,12 @@ InfoStreamBuilder &PDBFileBuilder::getInfoBuilder() { DbiStreamBuilder &PDBFileBuilder::getDbiBuilder() { if (!Dbi) - Dbi = llvm::make_unique<DbiStreamBuilder>(File->Allocator); + Dbi = llvm::make_unique<DbiStreamBuilder>(Allocator); return *Dbi; } -Expected<std::unique_ptr<PDBFile>> PDBFileBuilder::build() { +Expected<std::unique_ptr<PDBFile>> +PDBFileBuilder::build(std::unique_ptr<msf::StreamInterface> PdbFileBuffer) { if (Info) { uint32_t Length = Info->calculateSerializedLength(); if (auto EC = Msf->setStreamSize(StreamPDB, Length)) @@ -74,6 +75,7 @@ Expected<std::unique_ptr<PDBFile>> PDBFileBuilder::build() { if (!ExpectedLayout) return ExpectedLayout.takeError(); + auto File = llvm::make_unique<PDBFile>(std::move(PdbFileBuffer), Allocator); const msf::Layout &L = *ExpectedLayout; File->StreamMap = L.StreamMap; File->StreamSizes = L.StreamSizes; |