[PDB] Handle an empty globals hash table with no buckets

llvm-svn: 316722
This commit is contained in:
Reid Kleckner 2017-10-27 00:45:51 +00:00
parent 43169fb407
commit 06bac2866b
4 changed files with 13 additions and 4 deletions

View File

@ -117,7 +117,8 @@ Error GSIHashTable::read(BinaryStreamReader &Reader) {
return EC;
if (auto EC = readGSIHashRecords(HashRecords, HashHdr, Reader))
return EC;
if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr, Reader))
return EC;
if (HashHdr->HrSize > 0)
if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr, Reader))
return EC;
return Error::success();
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
RUN: llvm-pdbutil dump -globals %S/Inputs/pdbdump-globals-empty.pdb | FileCheck %s
CHECK: Global Symbols
CHECK: ============================================================
CHECK: Records
CHECK-NOT: S_

View File

@ -639,9 +639,11 @@ Error DumpOutputStyle::dumpUdtStats() {
}
auto &SymbolRecords = cantFail(getPdb().getPDBSymbolStream());
auto &Globals = cantFail(getPdb().getPDBGlobalsStream());
auto ExpGlobals = getPdb().getPDBGlobalsStream();
if (!ExpGlobals)
return ExpGlobals.takeError();
for (uint32_t PubSymOff : Globals.getGlobalsTable()) {
for (uint32_t PubSymOff : ExpGlobals->getGlobalsTable()) {
CVSymbol Sym = SymbolRecords.readRecord(PubSymOff);
HandleOneSymbol(Sym);
}