diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
| commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
| tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/DebugInfo/PDB/Native/PDBFile.cpp | |
| parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) | |
Notes
Diffstat (limited to 'lib/DebugInfo/PDB/Native/PDBFile.cpp')
| -rw-r--r-- | lib/DebugInfo/PDB/Native/PDBFile.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/DebugInfo/PDB/Native/PDBFile.cpp b/lib/DebugInfo/PDB/Native/PDBFile.cpp index 15b31d821b1c..78b11937f051 100644 --- a/lib/DebugInfo/PDB/Native/PDBFile.cpp +++ b/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 |
