diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-04-14 16:34:29 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-04-14 16:34:29 +0000 |
| commit | ed3bdc5f9ada3d87f1a7e7892305d240edd15c68 (patch) | |
| tree | 28fe7d68afdcce419228dc77a494ea2b8797e85b /lib/Serialization/GlobalModuleIndex.cpp | |
| parent | cbfcdc489635daac33b920325139396b41664990 (diff) | |
| download | clang-ed3bdc5f9ada3d87f1a7e7892305d240edd15c68.tar.gz clang-ed3bdc5f9ada3d87f1a7e7892305d240edd15c68.tar.bz2 clang-ed3bdc5f9ada3d87f1a7e7892305d240edd15c68.tar.xz | |
OnDiskHashTable: Make the iterable version separate.
Currently the on disk hash table's key_iterator and data_iterator make
the assumption that the table data starts exactly four bytes after the
base of the table. This happens to be true for all of the tables we
currently iterate over, but not for all of the OnDiskHashTables we
currently use. For example, key_ and data_iterator would iterate over
meaningless data if they were used on the hash tables in PTHLexer.
We make the API safer by breaking this into two types. One doesn't
have the iterators, and the other must be told where the payload
starts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/GlobalModuleIndex.cpp')
| -rw-r--r-- | lib/Serialization/GlobalModuleIndex.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Serialization/GlobalModuleIndex.cpp b/lib/Serialization/GlobalModuleIndex.cpp index 14b149f078..804a14363a 100644 --- a/lib/Serialization/GlobalModuleIndex.cpp +++ b/lib/Serialization/GlobalModuleIndex.cpp @@ -114,7 +114,8 @@ public: } }; -typedef OnDiskChainedHashTable<IdentifierIndexReaderTrait> IdentifierIndexTable; +typedef OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait> + IdentifierIndexTable; } @@ -210,9 +211,9 @@ GlobalModuleIndex::GlobalModuleIndex(llvm::MemoryBuffer *Buffer, // Wire up the identifier index. if (Record[0]) { IdentifierIndex = IdentifierIndexTable::Create( - (const unsigned char *)Blob.data() + Record[0], - (const unsigned char *)Blob.data(), - IdentifierIndexReaderTrait()); + (const unsigned char *)Blob.data() + Record[0], + (const unsigned char *)Blob.data() + sizeof(uint32_t), + (const unsigned char *)Blob.data(), IdentifierIndexReaderTrait()); } break; } @@ -591,11 +592,13 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { // Handle the identifier table if (State == ASTBlock && Code == IDENTIFIER_TABLE && Record[0] > 0) { - typedef OnDiskChainedHashTable<InterestingASTIdentifierLookupTrait> - InterestingIdentifierTable; + typedef + OnDiskIterableChainedHashTable<InterestingASTIdentifierLookupTrait> + InterestingIdentifierTable; std::unique_ptr<InterestingIdentifierTable> Table( InterestingIdentifierTable::Create( (const unsigned char *)Blob.data() + Record[0], + (const unsigned char *)Blob.data() + sizeof(uint32_t), (const unsigned char *)Blob.data())); for (InterestingIdentifierTable::data_iterator D = Table->data_begin(), DEnd = Table->data_end(); |
