diff options
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp')
| -rw-r--r-- | contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp index 15b31d821b1c..78b11937f051 100644 --- a/contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp +++ b/contrib/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp @@ -289,8 +289,8 @@ Expected<DbiStream &> PDBFile::getPDBDbiStream() { auto DbiS = safelyCreateIndexedStream(ContainerLayout, *Buffer, StreamDBI); if (!DbiS) return DbiS.takeError(); - auto TempDbi = llvm::make_unique<DbiStream>(*this, std::move(*DbiS)); - if (auto EC = TempDbi->reload()) + auto TempDbi = llvm::make_unique<DbiStream>(std::move(*DbiS)); + if (auto EC = TempDbi->reload(this)) return std::move(EC); Dbi = std::move(TempDbi); } @@ -370,7 +370,10 @@ Expected<PDBStringTable &> PDBFile::getStringTable() { if (!IS) return IS.takeError(); - uint32_t NameStreamIndex = IS->getNamedStreamIndex("/names"); + Expected<uint32_t> ExpectedNSI = IS->getNamedStreamIndex("/names"); + if (!ExpectedNSI) + return ExpectedNSI.takeError(); + uint32_t NameStreamIndex = *ExpectedNSI; auto NS = safelyCreateIndexedStream(ContainerLayout, *Buffer, NameStreamIndex); @@ -445,7 +448,13 @@ bool PDBFile::hasPDBStringTable() { auto IS = getPDBInfoStream(); if (!IS) return false; - return IS->getNamedStreamIndex("/names") < getNumStreams(); + Expected<uint32_t> ExpectedNSI = IS->getNamedStreamIndex("/names"); + if (!ExpectedNSI) { + consumeError(ExpectedNSI.takeError()); + return false; + } + assert(*ExpectedNSI < getNumStreams()); + return true; } /// Wrapper around MappedBlockStream::createIndexedStream() that checks if a |
