aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/OnDiskHashTable.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:27 +0000
commit5d26768e2661faa7ce0b55ffff4be8b3969fbbf5 (patch)
tree7d3df9e026a4e019d9821a82a382ab48ed6a403a /include/clang/Basic/OnDiskHashTable.h
parenteb3f04e60fa17dba27344ed89fd1b9134bb6839c (diff)
Introduce the mechanism for building an AST on-disk hash table for name lookup inside a DeclContext but don't use it yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/OnDiskHashTable.h')
-rw-r--r--include/clang/Basic/OnDiskHashTable.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h
index 2019e27ce5..aa3f344a6a 100644
--- a/include/clang/Basic/OnDiskHashTable.h
+++ b/include/clang/Basic/OnDiskHashTable.h
@@ -124,8 +124,9 @@ class OnDiskChainedHashTableGenerator {
Item *next;
const uint32_t hash;
- Item(typename Info::key_type_ref k, typename Info::data_type_ref d)
- : key(k), data(d), next(0), hash(Info::ComputeHash(k)) {}
+ Item(typename Info::key_type_ref k, typename Info::data_type_ref d,
+ Info &InfoObj)
+ : key(k), data(d), next(0), hash(InfoObj.ComputeHash(k)) {}
};
class Bucket {
@@ -168,10 +169,17 @@ public:
void insert(typename Info::key_type_ref key,
typename Info::data_type_ref data) {
+ Info InfoObj;
+ insert(key, data, InfoObj);
+ }
+
+ void insert(typename Info::key_type_ref key,
+ typename Info::data_type_ref data, Info &InfoObj) {
++NumEntries;
if (4*NumEntries >= 3*NumBuckets) resize(NumBuckets*2);
- insert(Buckets, NumBuckets, new (BA.Allocate<Item>()) Item(key, data));
+ insert(Buckets, NumBuckets, new (BA.Allocate<Item>()) Item(key, data,
+ InfoObj));
}
io::Offset Emit(llvm::raw_ostream &out) {
@@ -278,8 +286,8 @@ public:
InfoPtr = &InfoObj;
using namespace io;
- const internal_key_type& iKey = Info::GetInternalKey(eKey);
- unsigned key_hash = Info::ComputeHash(iKey);
+ const internal_key_type& iKey = InfoObj.GetInternalKey(eKey);
+ unsigned key_hash = InfoObj.ComputeHash(iKey);
// Each bucket is just a 32-bit offset into the hash table file.
unsigned idx = key_hash & (NumBuckets - 1);