[PDB] Avoid calling discoverTypeIndices for a known record kind

This particular overload allocates memory, and we do this for every
S_[GL]PROC32_ID record. Instead, hardcode the offset of the typeindex
that we are looking for in the LF_[MEM]FUNC_ID record. We already
assumed that looking up the item index already found a record of this
kind.
This commit is contained in:
Reid Kleckner 2020-05-02 15:48:31 -07:00
parent 0b85ea8533
commit bd7ea8641e
1 changed files with 3 additions and 4 deletions

View File

@ -726,10 +726,9 @@ static void translateIdSymbols(MutableArrayRef<uint8_t> &recordData,
// in both cases we just need the second type index.
if (!ti->isSimple() && !ti->isNoneType()) {
CVType funcIdData = iDTable.getType(*ti);
SmallVector<TypeIndex, 2> indices;
discoverTypeIndices(funcIdData, indices);
assert(indices.size() == 2);
*ti = indices[1];
ArrayRef<uint8_t> tiBuf = funcIdData.data().slice(8, 12);
assert(tiBuf.size() == 4 && "corruct LF_[MEM]FUNC_ID record");
*ti = *reinterpret_cast<const TypeIndex *>(tiBuf.data());
}
kind = (kind == SymbolKind::S_GPROC32_ID) ? SymbolKind::S_GPROC32