[llvm] r275150 - Re-enable TPI hash verification for enum records.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 20:25:03 PDT 2016


Author: ruiu
Date: Mon Jul 11 22:25:03 2016
New Revision: 275150

URL: http://llvm.org/viewvc/llvm-project?rev=275150&view=rev
Log:
Re-enable TPI hash verification for enum records.

We didn't read unique names correctly. As a result, we computed
hashes on (non-)unique names instead of unique names.

Modified:
    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
    llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp
    llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h?rev=275150&r1=275149&r2=275150&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h Mon Jul 11 22:25:03 2016
@@ -575,6 +575,10 @@ private:
     TypeIndex UnderlyingType;
     TypeIndex FieldListType;
     // Name: The null-terminated name follows.
+
+    bool hasUniqueName() const {
+      return Properties & uint16_t(ClassOptions::HasUniqueName);
+    }
   };
 
   TypeIndex UnderlyingType;

Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp?rev=275150&r1=275149&r2=275150&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeRecord.cpp Mon Jul 11 22:25:03 2016
@@ -166,12 +166,14 @@ ErrorOr<EnumRecord> EnumRecord::deserial
                                             ArrayRef<uint8_t> &Data) {
   const Layout *L = nullptr;
   StringRef Name;
-  CV_DESERIALIZE(Data, L, Name);
+  StringRef UniqueName;
+  CV_DESERIALIZE(Data, L, Name,
+                 CV_CONDITIONAL_FIELD(UniqueName, L->hasUniqueName()));
 
   uint16_t P = L->Properties;
   ClassOptions Options = static_cast<ClassOptions>(P);
-  return EnumRecord(L->NumEnumerators, Options, L->FieldListType, Name, Name,
-                    L->UnderlyingType);
+  return EnumRecord(L->NumEnumerators, Options, L->FieldListType, Name,
+                    UniqueName, L->UnderlyingType);
 }
 
 ErrorOr<BitFieldRecord> BitFieldRecord::deserialize(TypeRecordKind Kind,

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=275150&r1=275149&r2=275150&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp Mon Jul 11 22:25:03 2016
@@ -105,7 +105,7 @@ public:
   }
 
   Error visitClass(ClassRecord &Rec) override { return verify(Rec); }
-  Error visitEnum(EnumRecord &Rec) override { return Error::success(); }
+  Error visitEnum(EnumRecord &Rec) override { return verify(Rec); }
   Error visitUnion(UnionRecord &Rec) override { return verify(Rec); }
 
   Error visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) override {




More information about the llvm-commits mailing list