diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2019-07-12 18:24:38 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2019-07-12 18:24:38 +0000 |
| commit | 13f7ddff17ba1f4c5a51c83af1c83cb501ad0653 (patch) | |
| tree | 5b231a7ac4ff8a37b26d87895ff29c6e47e5363a /llvm/tools/llvm-pdbutil | |
| parent | db8e36481a2189422e60b00b709dbfb684074fc4 (diff) | |
| download | bcm5719-llvm-13f7ddff17ba1f4c5a51c83af1c83cb501ad0653.tar.gz bcm5719-llvm-13f7ddff17ba1f4c5a51c83af1c83cb501ad0653.zip | |
Slightly simplify MappedBlockStream::createIndexedStream() calls
All callers had a PDBFile object at hand, so call
Pdb.createIndexedStream() instead, which pre-populates all the arguments
(and returns nullptr for kInvalidStreamIndex).
Also change safelyCreateIndexedStream() to only take the string index,
and update callers. Make the method public and call it in two places
that manually did the bounds checking before.
No intended behavior change.
Differential Revision: https://reviews.llvm.org/D64633
llvm-svn: 365936
Diffstat (limited to 'llvm/tools/llvm-pdbutil')
| -rw-r--r-- | llvm/tools/llvm-pdbutil/BytesOutputStyle.cpp | 4 | ||||
| -rw-r--r-- | llvm/tools/llvm-pdbutil/LinePrinter.cpp | 3 | ||||
| -rw-r--r-- | llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp | 5 | ||||
| -rw-r--r-- | llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 3 |
4 files changed, 4 insertions, 11 deletions
diff --git a/llvm/tools/llvm-pdbutil/BytesOutputStyle.cpp b/llvm/tools/llvm-pdbutil/BytesOutputStyle.cpp index a8ea5ba897c..162d12c120b 100644 --- a/llvm/tools/llvm-pdbutil/BytesOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/BytesOutputStyle.cpp @@ -340,9 +340,7 @@ static void iterateOneModule(PDBFile &File, LinePrinter &P, if (ModiStream == kInvalidStreamIndex) return; - auto ModStreamData = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), ModiStream, - File.getAllocator()); + auto ModStreamData = File.createIndexedStream(ModiStream); ModuleDebugStreamRef ModStream(Modi, std::move(ModStreamData)); if (auto EC = ModStream.reload()) { P.formatLine("Could not parse debug information."); diff --git a/llvm/tools/llvm-pdbutil/LinePrinter.cpp b/llvm/tools/llvm-pdbutil/LinePrinter.cpp index aae8809be63..280c000bd65 100644 --- a/llvm/tools/llvm-pdbutil/LinePrinter.cpp +++ b/llvm/tools/llvm-pdbutil/LinePrinter.cpp @@ -186,8 +186,7 @@ void LinePrinter::formatMsfStreamData(StringRef Label, PDBFile &File, return; } - auto S = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), StreamIdx, File.getAllocator()); + auto S = File.createIndexedStream(StreamIdx); if (!S) { NewLine(); formatLine("Stream {0}: Not present", StreamIdx); diff --git a/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp b/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp index f81381e1727..80b76657fac 100644 --- a/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp @@ -231,10 +231,7 @@ Error YAMLOutputStyle::dumpDbiStream() { if (ModiStream == kInvalidStreamIndex) continue; - auto ModStreamData = msf::MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), ModiStream, - File.getAllocator()); - + auto ModStreamData = File.createIndexedStream(ModiStream); pdb::ModuleDebugStreamRef ModS(MI, std::move(ModStreamData)); if (auto EC = ModS.reload()) return EC; diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index 43a4259cf38..a19257af38d 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -1384,8 +1384,7 @@ static void exportStream() { << "' (index " << Index << ") to file " << OutFileName << ".\n"; } - SourceStream = MappedBlockStream::createIndexedStream( - File.getMsfLayout(), File.getMsfBuffer(), Index, File.getAllocator()); + SourceStream = File.createIndexedStream(Index); auto OutFile = ExitOnErr( FileOutputBuffer::create(OutFileName, SourceStream->getLength())); FileBufferByteStream DestStream(std::move(OutFile), llvm::support::little); |

