From 1e5793345bc69a735b05318644520d420b4bfc3a Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Sat, 2 May 2020 18:33:27 -0700 Subject: [PATCH] Re-land "[PDB] Avoid calling discoverTypeIndices for a known record kind" Fixed bad usage of slice API causing assertion failures. Reverts 810c8e9b495c191f49b162cee3fb8829185a2691 Reinstates bd7ea8641e7667b109534ae06b33be7bc9b59821 --- lld/COFF/PDB.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index a182ed34165de..6ec2be3da9948 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -726,10 +726,9 @@ static void translateIdSymbols(MutableArrayRef &recordData, // in both cases we just need the second type index. if (!ti->isSimple() && !ti->isNoneType()) { CVType funcIdData = iDTable.getType(*ti); - SmallVector indices; - discoverTypeIndices(funcIdData, indices); - assert(indices.size() == 2); - *ti = indices[1]; + ArrayRef tiBuf = funcIdData.data().slice(8, 4); + assert(tiBuf.size() == 4 && "corruct LF_[MEM]FUNC_ID record"); + *ti = *reinterpret_cast(tiBuf.data()); } kind = (kind == SymbolKind::S_GPROC32_ID) ? SymbolKind::S_GPROC32