Index: include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h =================================================================== --- include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h +++ include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h @@ -60,7 +60,6 @@ Error finalizeMsfLayout(); - Expected> build(PDBFile &File); Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer); Index: include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h =================================================================== --- include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h +++ include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h @@ -43,8 +43,6 @@ Error finalizeMsfLayout(); - Expected> build(PDBFile &File); - Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer) const; Index: include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h =================================================================== --- include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h +++ include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h @@ -45,9 +45,6 @@ TpiStreamBuilder &getTpiBuilder(); TpiStreamBuilder &getIpiBuilder(); - Expected> - build(std::unique_ptr PdbFileBuffer); - Error commit(StringRef Filename); private: Index: include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h =================================================================== --- include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h +++ include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h @@ -56,8 +56,6 @@ Error finalizeMsfLayout(); - Expected> build(PDBFile &File); - Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer); uint32_t calculateSerializedLength() const; Index: lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp +++ lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp @@ -357,27 +357,6 @@ return Ret; } -Expected> -DbiStreamBuilder::build(PDBFile &File) { - if (!VerHeader.hasValue()) - return make_error(raw_error_code::unspecified, - "Missing DBI Stream Version"); - if (auto EC = finalize()) - return std::move(EC); - - auto StreamData = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), StreamDBI); - auto Dbi = llvm::make_unique(File, std::move(StreamData)); - Dbi->Header = Header; - Dbi->FileInfoSubstream = ReadableStreamRef(FileInfoBuffer); - Dbi->ModInfoSubstream = ReadableStreamRef(ModInfoBuffer); - if (auto EC = Dbi->initializeModInfoArray()) - return std::move(EC); - if (auto EC = Dbi->initializeFileInfo()) - return std::move(EC); - return std::move(Dbi); -} - Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer) { if (auto EC = finalize()) Index: lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp +++ lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp @@ -47,22 +47,6 @@ return Error::success(); } -Expected> -InfoStreamBuilder::build(PDBFile &File) { - auto StreamData = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), StreamPDB); - auto Info = llvm::make_unique(std::move(StreamData)); - Info->Version = Ver; - Info->Signature = Sig; - Info->Age = Age; - Info->Guid = Guid; - auto NS = NamedStreams.build(); - if (!NS) - return NS.takeError(); - Info->NamedStreams = **NS; - return std::move(Info); -} - Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer) const { auto InfoS = Index: lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp +++ lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp @@ -87,51 +87,6 @@ return Msf->build(); } -Expected> -PDBFileBuilder::build(std::unique_ptr PdbFileBuffer) { - auto ExpectedLayout = finalizeMsfLayout(); - if (!ExpectedLayout) - return ExpectedLayout.takeError(); - - auto File = llvm::make_unique(std::move(PdbFileBuffer), Allocator); - File->ContainerLayout = *ExpectedLayout; - - if (Info) { - auto ExpectedInfo = Info->build(*File); - if (!ExpectedInfo) - return ExpectedInfo.takeError(); - File->Info = std::move(*ExpectedInfo); - } - - if (Dbi) { - auto ExpectedDbi = Dbi->build(*File); - if (!ExpectedDbi) - return ExpectedDbi.takeError(); - File->Dbi = std::move(*ExpectedDbi); - } - - if (Tpi) { - auto ExpectedTpi = Tpi->build(*File); - if (!ExpectedTpi) - return ExpectedTpi.takeError(); - File->Tpi = std::move(*ExpectedTpi); - } - - if (Ipi) { - auto ExpectedIpi = Ipi->build(*File); - if (!ExpectedIpi) - return ExpectedIpi.takeError(); - File->Ipi = std::move(*ExpectedIpi); - } - - if (File->Info && File->Dbi && File->Info->getAge() != File->Dbi->getAge()) - return llvm::make_error( - raw_error_code::corrupt_file, - "PDB Stream Age doesn't match Dbi Stream Age!"); - - return std::move(File); -} - Error PDBFileBuilder::commit(StringRef Filename) { auto ExpectedLayout = finalizeMsfLayout(); if (!ExpectedLayout) Index: lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp +++ lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp @@ -99,27 +99,6 @@ return Error::success(); } -Expected> TpiStreamBuilder::build(PDBFile &File) { - if (!VerHeader.hasValue()) - return make_error(raw_error_code::unspecified, - "Missing TPI Stream Version"); - if (auto EC = finalize()) - return std::move(EC); - - auto StreamData = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), Idx); - auto Tpi = llvm::make_unique(File, std::move(StreamData)); - Tpi->Header = Header; - Tpi->TypeRecords = VarStreamArray(TypeRecordStream); - if (HashValueStream) { - Tpi->HashStream = std::move(HashValueStream); - StreamReader HSR(*Tpi->HashStream); - if (auto EC = HSR.readArray(Tpi->HashValues, TypeRecords.size())) - return std::move(EC); - } - return std::move(Tpi); -} - Error TpiStreamBuilder::commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer) { if (auto EC = finalize())