aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/OnDiskHashTable.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-24 21:10:55 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-24 21:10:55 +0000
commitf0aaf7a59729a4ae0146e3464ee987745be95829 (patch)
tree713860e07637f8137d9a5210f6fd6a9e325afca7 /include/clang/Basic/OnDiskHashTable.h
parentd019d96e1ea39cec32f1320b1f9f772aae28247e (diff)
PCH support for the global method pool (= instance and factory method
pools, combined). The methods in the global method pool are lazily loaded from an on-disk hash table when Sema looks into its version of the hash tables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/OnDiskHashTable.h')
-rw-r--r--include/clang/Basic/OnDiskHashTable.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h
index 3caeb9ffd8..f54d67042c 100644
--- a/include/clang/Basic/OnDiskHashTable.h
+++ b/include/clang/Basic/OnDiskHashTable.h
@@ -41,6 +41,11 @@ inline unsigned BernsteinHash(const char* x, unsigned n) {
return R + (R >> 5);
}
+inline unsigned BernsteinHashPartial(const char* x, unsigned n, unsigned R) {
+ for (unsigned i = 0 ; i < n ; ++i, ++x) R = R * 33 + *x;
+ return R + (R >> 5);
+}
+
namespace io {
typedef uint32_t Offset;
@@ -199,7 +204,8 @@ public:
// Store the offset for the data of this bucket.
B.off = out.tell();
-
+ assert(B.off && "Cannot write a bucket at offset 0. Please add padding.");
+
// Write out the number of items in the bucket.
Emit16(out, B.length);
@@ -318,7 +324,7 @@ public:
// Read the key.
const internal_key_type& X =
- Info::ReadKey((const unsigned char* const) Items, L.first);
+ InfoPtr->ReadKey((const unsigned char* const) Items, L.first);
// If the key doesn't match just skip reading the value.
if (!Info::EqualKey(X, iKey)) {