[PATCH] D48361: [ADT] Allow llvm::hash_code as DenseMap key.

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 07:00:57 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL335125: [ADT] Allow llvm::hash_code as DenseMap key. (authored by sammccall, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48361

Files:
  llvm/trunk/include/llvm/ADT/DenseMapInfo.h


Index: llvm/trunk/include/llvm/ADT/DenseMapInfo.h
===================================================================
--- llvm/trunk/include/llvm/ADT/DenseMapInfo.h
+++ llvm/trunk/include/llvm/ADT/DenseMapInfo.h
@@ -262,6 +262,13 @@
   }
 };
 
+template <> struct DenseMapInfo<hash_code> {
+  static inline hash_code getEmptyKey() { return hash_code(-1); }
+  static inline hash_code getTombstoneKey() { return hash_code(-2); }
+  static unsigned getHashValue(hash_code val) { return val; }
+  static bool isEqual(hash_code LHS, hash_code RHS) { return LHS == RHS; }
+};
+
 } // end namespace llvm
 
 #endif // LLVM_ADT_DENSEMAPINFO_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48361.152079.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180620/674db801/attachment.bin>


More information about the llvm-commits mailing list