OSDN Git Service

ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 4 Dec 2020 03:05:11 +0000 (19:05 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 8 Dec 2020 21:46:21 +0000 (13:46 -0800)
Simplify the DenseMapInfo for `EditEntry` by migrating from
`FoldingSetNodeID` to `llvm::hash_combine`. Besides the cleanup, this
reduces the diff for a future patch which changes the type of one of the
fields.

There should be no real functionality change here, although I imagine
the hash value will churn since its a different hashing infrastructure.

Differential Revision: https://reviews.llvm.org/D92630

clang/lib/ARCMigrate/ObjCMT.cpp

index ef2985d..dfc0d93 100644 (file)
@@ -2054,12 +2054,8 @@ template<> struct DenseMapInfo<EditEntry> {
     return Entry;
   }
   static unsigned getHashValue(const EditEntry& Val) {
-    llvm::FoldingSetNodeID ID;
-    ID.AddPointer(Val.File);
-    ID.AddInteger(Val.Offset);
-    ID.AddInteger(Val.RemoveLen);
-    ID.AddString(Val.Text);
-    return ID.ComputeHash();
+    return (unsigned)llvm::hash_combine(Val.File, Val.Offset, Val.RemoveLen,
+                                        Val.Text);
   }
   static bool isEqual(const EditEntry &LHS, const EditEntry &RHS) {
     return LHS.File == RHS.File &&