@@ -233,7 +233,8 @@ ArrayRef<support::ulittle32_t> PDBFile::getDirectoryBlockArray() const {
233
233
return ContainerLayout.DirectoryBlocks ;
234
234
}
235
235
236
- std::unique_ptr<MappedBlockStream> PDBFile::createIndexedStream (uint16_t SN) {
236
+ std::unique_ptr<MappedBlockStream>
237
+ PDBFile::createIndexedStream (uint16_t SN) const {
237
238
if (SN == kInvalidStreamIndex )
238
239
return nullptr ;
239
240
return MappedBlockStream::createIndexedStream (ContainerLayout, *Buffer, SN,
@@ -258,8 +259,8 @@ Expected<GlobalsStream &> PDBFile::getPDBGlobalsStream() {
258
259
if (!DbiS)
259
260
return DbiS.takeError ();
260
261
261
- auto GlobalS = safelyCreateIndexedStream (
262
- ContainerLayout, *Buffer, DbiS->getGlobalSymbolStreamIndex ());
262
+ auto GlobalS =
263
+ safelyCreateIndexedStream ( DbiS->getGlobalSymbolStreamIndex ());
263
264
if (!GlobalS)
264
265
return GlobalS.takeError ();
265
266
auto TempGlobals = llvm::make_unique<GlobalsStream>(std::move (*GlobalS));
@@ -272,7 +273,7 @@ Expected<GlobalsStream &> PDBFile::getPDBGlobalsStream() {
272
273
273
274
Expected<InfoStream &> PDBFile::getPDBInfoStream () {
274
275
if (!Info) {
275
- auto InfoS = safelyCreateIndexedStream (ContainerLayout, *Buffer, StreamPDB);
276
+ auto InfoS = safelyCreateIndexedStream (StreamPDB);
276
277
if (!InfoS)
277
278
return InfoS.takeError ();
278
279
auto TempInfo = llvm::make_unique<InfoStream>(std::move (*InfoS));
@@ -285,7 +286,7 @@ Expected<InfoStream &> PDBFile::getPDBInfoStream() {
285
286
286
287
Expected<DbiStream &> PDBFile::getPDBDbiStream () {
287
288
if (!Dbi) {
288
- auto DbiS = safelyCreateIndexedStream (ContainerLayout, *Buffer, StreamDBI);
289
+ auto DbiS = safelyCreateIndexedStream (StreamDBI);
289
290
if (!DbiS)
290
291
return DbiS.takeError ();
291
292
auto TempDbi = llvm::make_unique<DbiStream>(std::move (*DbiS));
@@ -298,7 +299,7 @@ Expected<DbiStream &> PDBFile::getPDBDbiStream() {
298
299
299
300
Expected<TpiStream &> PDBFile::getPDBTpiStream () {
300
301
if (!Tpi) {
301
- auto TpiS = safelyCreateIndexedStream (ContainerLayout, *Buffer, StreamTPI);
302
+ auto TpiS = safelyCreateIndexedStream (StreamTPI);
302
303
if (!TpiS)
303
304
return TpiS.takeError ();
304
305
auto TempTpi = llvm::make_unique<TpiStream>(*this , std::move (*TpiS));
@@ -314,7 +315,7 @@ Expected<TpiStream &> PDBFile::getPDBIpiStream() {
314
315
if (!hasPDBIpiStream ())
315
316
return make_error<RawError>(raw_error_code::no_stream);
316
317
317
- auto IpiS = safelyCreateIndexedStream (ContainerLayout, *Buffer, StreamIPI);
318
+ auto IpiS = safelyCreateIndexedStream (StreamIPI);
318
319
if (!IpiS)
319
320
return IpiS.takeError ();
320
321
auto TempIpi = llvm::make_unique<TpiStream>(*this , std::move (*IpiS));
@@ -331,8 +332,8 @@ Expected<PublicsStream &> PDBFile::getPDBPublicsStream() {
331
332
if (!DbiS)
332
333
return DbiS.takeError ();
333
334
334
- auto PublicS = safelyCreateIndexedStream (
335
- ContainerLayout, *Buffer, DbiS->getPublicSymbolStreamIndex ());
335
+ auto PublicS =
336
+ safelyCreateIndexedStream ( DbiS->getPublicSymbolStreamIndex ());
336
337
if (!PublicS)
337
338
return PublicS.takeError ();
338
339
auto TempPublics = llvm::make_unique<PublicsStream>(std::move (*PublicS));
@@ -350,8 +351,7 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() {
350
351
return DbiS.takeError ();
351
352
352
353
uint32_t SymbolStreamNum = DbiS->getSymRecordStreamIndex ();
353
- auto SymbolS =
354
- safelyCreateIndexedStream (ContainerLayout, *Buffer, SymbolStreamNum);
354
+ auto SymbolS = safelyCreateIndexedStream (SymbolStreamNum);
355
355
if (!SymbolS)
356
356
return SymbolS.takeError ();
357
357
@@ -374,8 +374,7 @@ Expected<PDBStringTable &> PDBFile::getStringTable() {
374
374
return ExpectedNSI.takeError ();
375
375
uint32_t NameStreamIndex = *ExpectedNSI;
376
376
377
- auto NS =
378
- safelyCreateIndexedStream (ContainerLayout, *Buffer, NameStreamIndex);
377
+ auto NS = safelyCreateIndexedStream (NameStreamIndex);
379
378
if (!NS)
380
379
return NS.takeError ();
381
380
@@ -463,11 +462,9 @@ bool PDBFile::hasPDBStringTable() {
463
462
// / will have an MSFError with code msf_error_code::no_stream. Else, the return
464
463
// / value will contain the stream returned by createIndexedStream().
465
464
Expected<std::unique_ptr<MappedBlockStream>>
466
- PDBFile::safelyCreateIndexedStream (const MSFLayout &Layout,
467
- BinaryStreamRef MsfData,
468
- uint32_t StreamIndex) const {
465
+ PDBFile::safelyCreateIndexedStream (uint32_t StreamIndex) const {
469
466
if (StreamIndex >= getNumStreams ())
467
+ // This rejects kInvalidStreamIndex with an error as well.
470
468
return make_error<RawError>(raw_error_code::no_stream);
471
- return MappedBlockStream::createIndexedStream (Layout, MsfData, StreamIndex,
472
- Allocator);
469
+ return createIndexedStream (StreamIndex);
473
470
}
0 commit comments