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.

llvm-svn: 275150
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 1a6f82f..42751fb 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -575,6 +575,10 @@
     TypeIndex UnderlyingType;
     TypeIndex FieldListType;
     // Name: The null-terminated name follows.
+
+    bool hasUniqueName() const {
+      return Properties & uint16_t(ClassOptions::HasUniqueName);
+    }
   };
 
   TypeIndex UnderlyingType;
diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
index 40f963f..f63371e 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeRecord.cpp
@@ -166,12 +166,14 @@
                                             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,
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp
index 8b44ec1..5617e57 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp
@@ -105,7 +105,7 @@
   }
 
   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 {