[llvm] r287697 - Remove PDBFileBuilder::build() and related functions.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 12:32:22 PST 2016
Author: ruiu
Date: Tue Nov 22 14:32:22 2016
New Revision: 287697
URL: http://llvm.org/viewvc/llvm-project?rev=287697&view=rev
Log:
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
Modified:
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h
llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h Tue Nov 22 14:32:22 2016
@@ -60,7 +60,6 @@ public:
Error finalizeMsfLayout();
- Expected<std::unique_ptr<DbiStream>> build(PDBFile &File);
Error commit(const msf::MSFLayout &Layout,
const msf::WritableStream &Buffer);
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h Tue Nov 22 14:32:22 2016
@@ -43,8 +43,6 @@ public:
Error finalizeMsfLayout();
- Expected<std::unique_ptr<InfoStream>> build(PDBFile &File);
-
Error commit(const msf::MSFLayout &Layout,
const msf::WritableStream &Buffer) const;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h Tue Nov 22 14:32:22 2016
@@ -45,9 +45,6 @@ public:
TpiStreamBuilder &getTpiBuilder();
TpiStreamBuilder &getIpiBuilder();
- Expected<std::unique_ptr<PDBFile>>
- build(std::unique_ptr<msf::WritableStream> PdbFileBuffer);
-
Error commit(StringRef Filename);
private:
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h Tue Nov 22 14:32:22 2016
@@ -56,8 +56,6 @@ public:
Error finalizeMsfLayout();
- Expected<std::unique_ptr<TpiStream>> build(PDBFile &File);
-
Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer);
uint32_t calculateSerializedLength() const;
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp Tue Nov 22 14:32:22 2016
@@ -357,27 +357,6 @@ std::vector<SecMapEntry> DbiStreamBuilde
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())
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStreamBuilder.cpp Tue Nov 22 14:32:22 2016
@@ -47,22 +47,6 @@ Error InfoStreamBuilder::finalizeMsfLayo
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 =
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp Tue Nov 22 14:32:22 2016
@@ -87,51 +87,6 @@ Expected<msf::MSFLayout> PDBFileBuilder:
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)
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp?rev=287697&r1=287696&r2=287697&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp Tue Nov 22 14:32:22 2016
@@ -99,27 +99,6 @@ Error TpiStreamBuilder::finalizeMsfLayou
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())
More information about the llvm-commits
mailing list