[lld] 1e57933 - Re-land "[PDB] Avoid calling discoverTypeIndices for a known record kind"

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 18:41:16 PDT 2020


Author: Reid Kleckner
Date: 2020-05-02T18:39:33-07:00
New Revision: 1e5793345bc69a735b05318644520d420b4bfc3a

URL: https://github.com/llvm/llvm-project/commit/1e5793345bc69a735b05318644520d420b4bfc3a
DIFF: https://github.com/llvm/llvm-project/commit/1e5793345bc69a735b05318644520d420b4bfc3a.diff

LOG: Re-land "[PDB] Avoid calling discoverTypeIndices for a known record kind"

Fixed bad usage of slice API causing assertion failures.

Reverts 810c8e9b495c191f49b162cee3fb8829185a2691
Reinstates bd7ea8641e7667b109534ae06b33be7bc9b59821

Added: 
    

Modified: 
    lld/COFF/PDB.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index a182ed34165d..6ec2be3da994 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -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, 4);
+      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


        


More information about the llvm-commits mailing list