From 5ec7ee3af8dc988ef9a96ffff20d43235a7356d2 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 1 Jul 2016 00:37:25 +0000 Subject: [PATCH] [PDB] Indicate which type record failed hash validation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274308 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/PDB/Raw/TpiStream.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/lib/DebugInfo/PDB/Raw/TpiStream.cpp index feb6f2b88d1..016c51b8f4e 100644 --- a/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -118,7 +118,7 @@ private: template Error verify(T &Rec) { uint32_t Hash = getTpiHash(Rec, *RawRecord); if (Hash % NumHashBuckets != HashValues[Index]) - return make_error(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(raw_error_code::invalid_tpi_hash); + return errorInvalidHash(); return Error::success(); } + Error errorInvalidHash() { + return make_error( + raw_error_code::invalid_tpi_hash, + "Type index is 0x" + utohexstr(TypeIndex::FirstNonSimpleIndex + Index)); + } + FixedStreamArray HashValues; const CVRecord *RawRecord; uint32_t NumHashBuckets; -- 2.50.1