[llvm] r274308 - [PDB] Indicate which type record failed hash validation

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 17:37:25 PDT 2016


Author: rnk
Date: Thu Jun 30 19:37:25 2016
New Revision: 274308

URL: http://llvm.org/viewvc/llvm-project?rev=274308&view=rev
Log:
[PDB] Indicate which type record failed hash validation

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

Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp?rev=274308&r1=274307&r2=274308&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp Thu Jun 30 19:37:25 2016
@@ -118,7 +118,7 @@ private:
   template <typename T> Error verify(T &Rec) {
     uint32_t Hash = getTpiHash(Rec, *RawRecord);
     if (Hash % NumHashBuckets != HashValues[Index])
-      return make_error<RawError>(raw_error_code::invalid_tpi_hash);
+      return errorInvalidHash();
     return Error::success();
   }
 
@@ -127,10 +127,16 @@ private:
     support::endian::write32le(Buf, Rec.getUDT().getIndex());
     uint32_t Hash = hashStringV1(StringRef(Buf, 4));
     if (Hash % NumHashBuckets != HashValues[Index])
-      return make_error<RawError>(raw_error_code::invalid_tpi_hash);
+      return errorInvalidHash();
     return Error::success();
   }
 
+  Error errorInvalidHash() {
+    return make_error<RawError>(
+        raw_error_code::invalid_tpi_hash,
+        "Type index is 0x" + utohexstr(TypeIndex::FirstNonSimpleIndex + Index));
+  }
+
   FixedStreamArray<support::ulittle32_t> HashValues;
   const CVRecord<TypeLeafKind> *RawRecord;
   uint32_t NumHashBuckets;




More information about the llvm-commits mailing list