[llvm] r348166 - Fix issue with Tpi Stream hash map.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 11:05:12 PST 2018


Author: zturner
Date: Mon Dec  3 11:05:12 2018
New Revision: 348166

URL: http://llvm.org/viewvc/llvm-project?rev=348166&view=rev
Log:
Fix issue with Tpi Stream hash map.

Part of the patch to not build the hash map eagerly was omitted
due to a merge conflict.  Add it back, which should fix the failing
tests.

Modified:
    llvm/trunk/lib/DebugInfo/PDB/Native/TpiStream.cpp

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/TpiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/TpiStream.cpp?rev=348166&r1=348165&r2=348166&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/TpiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/TpiStream.cpp Mon Dec  3 11:05:12 2018
@@ -160,6 +160,9 @@ void TpiStream::buildHashMap() {
 }
 
 std::vector<TypeIndex> TpiStream::findRecordsByName(StringRef Name) const {
+  if (!supportsTypeLookup())
+    const_cast<TpiStream*>(this)->buildHashMap();
+
   uint32_t Bucket = hashStringV1(Name) % Header->NumHashBuckets;
   if (Bucket > HashMap.size())
     return {};
@@ -177,6 +180,9 @@ bool TpiStream::supportsTypeLookup() con
 
 Expected<TypeIndex>
 TpiStream::findFullDeclForForwardRef(TypeIndex ForwardRefTI) const {
+  if (!supportsTypeLookup())
+    const_cast<TpiStream*>(this)->buildHashMap();
+
   CVType F = Types->getType(ForwardRefTI);
   if (!isUdtForwardRef(F))
     return ForwardRefTI;




More information about the llvm-commits mailing list