diff options
author | Rui Ueyama <ruiu@google.com> | 2016-09-30 20:34:44 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-09-30 20:34:44 +0000 |
commit | fc22cef98ed96ac3aa471b66315ebc54e3421762 (patch) | |
tree | 1fbfa0bf268c529479a2109968b575f013e20044 /llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp | |
parent | e2d19c3d1e97ac4796b418abc9a26751fd932029 (diff) | |
download | bcm5719-llvm-fc22cef98ed96ac3aa471b66315ebc54e3421762.tar.gz bcm5719-llvm-fc22cef98ed96ac3aa471b66315ebc54e3421762.zip |
Pass a filename instead of a msf::WritableStream to PDBFileBuilder::commit.
WritableStream needs the exact file size to open a file, but
until we fix the final layout of a PDB file, we don't know the
size of the file.
This patch changes the parameter type of PDBFileBuilder::commit
to solve that chiecken-and-egg problem. Now the function opens
a file after fixing the layout, so it can create a file with the
exact size.
Differential Revision: https://reviews.llvm.org/D25107
llvm-svn: 282940
Diffstat (limited to 'llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp')
-rw-r--r-- | llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp index ca4666085d6..bfd9058627f 100644 --- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp +++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -321,14 +321,6 @@ static void yamlToPdb(StringRef Path) { ExitOnErr(make_error<GenericError>(generic_error_code::unspecified, "Yaml does not contain MSF headers")); - auto OutFileOrError = FileOutputBuffer::create( - opts::yaml2pdb::YamlPdbOutputFile, YamlObj.Headers->FileSize); - if (OutFileOrError.getError()) - ExitOnErr(make_error<GenericError>(generic_error_code::invalid_path, - opts::yaml2pdb::YamlPdbOutputFile)); - - auto FileByteStream = - llvm::make_unique<FileBufferByteStream>(std::move(*OutFileOrError)); PDBFileBuilder Builder(Allocator); ExitOnErr(Builder.initialize(YamlObj.Headers->SuperBlock)); @@ -382,7 +374,7 @@ static void yamlToPdb(StringRef Path) { IpiBuilder.addTypeRecord(R.Record); } - ExitOnErr(Builder.commit(*FileByteStream)); + ExitOnErr(Builder.commit(opts::yaml2pdb::YamlPdbOutputFile)); } static void pdb2Yaml(StringRef Path) { |