[llvm-branch-commits] [clang] b85c6e5 - ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry

Duncan P. N. Exon Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 8 13:50:33 PST 2020


Author: Duncan P. N. Exon Smith
Date: 2020-12-08T13:46:21-08:00
New Revision: b85c6e5bcd1a9de941c318f9a5dc742818752a56

URL: https://github.com/llvm/llvm-project/commit/b85c6e5bcd1a9de941c318f9a5dc742818752a56
DIFF: https://github.com/llvm/llvm-project/commit/b85c6e5bcd1a9de941c318f9a5dc742818752a56.diff

LOG: ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry

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

Added: 
    

Modified: 
    clang/lib/ARCMigrate/ObjCMT.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index ef2985d16d23..dfc0d9353165 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -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 &&


        


More information about the llvm-branch-commits mailing list