diff options
author | Rui Ueyama <ruiu@google.com> | 2016-11-22 20:32:22 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-11-22 20:32:22 +0000 |
commit | 2b4ba04d57b35d638e15d71ec6d1e8622e1ea49a (patch) | |
tree | a7d5ce91d8efea030ccdf6dd1542043c83be5277 /llvm/lib/DebugInfo | |
parent | e99e8d345c0bde318befd55cb5ce14d787f960f6 (diff) | |
download | bcm5719-llvm-2b4ba04d57b35d638e15d71ec6d1e8622e1ea49a.tar.gz bcm5719-llvm-2b4ba04d57b35d638e15d71ec6d1e8622e1ea49a.zip |
Remove PDBFileBuilder::build() and related functions.
PDBFileBuilder supports two different ways to create files.
One is PDBFileBuilder::commit. That function takes a filename
and write a result to the file. The other is PDBFileBuilder::build.
That returns a new PDBFile object.
This patch removes the latter because no one is using it and
in a real life situation we are very unlikely to need it.
Even if you need it, it'd be easy to write a new PDB to a memory
buffer and read it back.
Removing PDBFileBuilder::build enables us to remove other classes
build transitively.
Differential Revision: https://reviews.llvm.org/D26987
llvm-svn: 287697
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp | 45 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp | 21 |
4 files changed, 0 insertions, 103 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp index 33c07ffa3b8..1d5b8d693b1 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp @@ -357,27 +357,6 @@ std::vector<SecMapEntry> DbiStreamBuilder::createSectionMap( return Ret; } -Expected<std::unique_ptr<DbiStream>> -DbiStreamBuilder::build(PDBFile &File) { - if (!VerHeader.hasValue()) - return make_error<RawError>(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<DbiStream>(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()) diff --git a/llvm/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp index e909c30e95f..73fbf853b4f 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp @@ -47,22 +47,6 @@ Error InfoStreamBuilder::finalizeMsfLayout() { return Error::success(); } -Expected<std::unique_ptr<InfoStream>> -InfoStreamBuilder::build(PDBFile &File) { - auto StreamData = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), StreamPDB); - auto Info = llvm::make_unique<InfoStream>(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 = diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp index e47d11cf61a..6fec0e32a8a 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp @@ -87,51 +87,6 @@ Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() const { return Msf->build(); } -Expected<std::unique_ptr<PDBFile>> -PDBFileBuilder::build(std::unique_ptr<msf::WritableStream> PdbFileBuffer) { - auto ExpectedLayout = finalizeMsfLayout(); - if (!ExpectedLayout) - return ExpectedLayout.takeError(); - - auto File = llvm::make_unique<PDBFile>(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<RawError>( - 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) diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp index d8bae59195c..aa3547c93c4 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp @@ -99,27 +99,6 @@ Error TpiStreamBuilder::finalizeMsfLayout() { return Error::success(); } -Expected<std::unique_ptr<TpiStream>> TpiStreamBuilder::build(PDBFile &File) { - if (!VerHeader.hasValue()) - return make_error<RawError>(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<TpiStream>(File, std::move(StreamData)); - Tpi->Header = Header; - Tpi->TypeRecords = VarStreamArray<codeview::CVType>(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()) |