Add support for on-disk hash table lookup with a known hash, for situations where...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Jul 2015 18:40:59 +0000 (18:40 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 14 Jul 2015 18:40:59 +0000 (18:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242179 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/OnDiskHashTable.h

index 0f097f28728640ceaa4c170a52dd721c0f361d94..08e277ad5ce1e95783352a1e63b2d2ad4fa1074a 100644 (file)
@@ -280,13 +280,19 @@ public:
   };
 
   /// \brief Look up the stored data for a particular key.
-  iterator find(const external_key_type &EKey, Info *InfoPtr = 0) {
-    if (!InfoPtr)
-      InfoPtr = &InfoObj;
-
-    using namespace llvm::support;
+  iterator find(const external_key_type &EKey, Info *InfoPtr = nullptr) {
     const internal_key_type &IKey = InfoObj.GetInternalKey(EKey);
     hash_value_type KeyHash = InfoObj.ComputeHash(IKey);
+    return find_hashed(IKey, KeyHash, InfoPtr);
+  }
+
+  /// \brief Look up the stored data for a particular key with a known hash.
+  iterator find_hashed(const internal_key_type &IKey, hash_value_type KeyHash,
+                       Info *InfoPtr = nullptr) {
+    using namespace llvm::support;
+
+    if (!InfoPtr)
+      InfoPtr = &InfoObj;
 
     // Each bucket is just an offset into the hash table file.
     offset_type Idx = KeyHash & (NumBuckets - 1);