summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-04-14 16:34:29 +0000
committerJustin Bogner <mail@justinbogner.com>2014-04-14 16:34:29 +0000
commitda4e650e5c14432fee19d37d0cccfbe6668e6b0a (patch)
tree64586cae295cc1a1bbcd0e3eb84653ef2b9a6b83 /clang/lib/Serialization/ASTReader.cpp
parent8c1f0818c040d88e28e1f168fe73138a97c58cc3 (diff)
downloadbcm5719-llvm-da4e650e5c14432fee19d37d0cccfbe6668e6b0a.tar.gz
bcm5719-llvm-da4e650e5c14432fee19d37d0cccfbe6668e6b0a.zip
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. llvm-svn: 206189
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 18768353c1c..1d1957d6bfe 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -851,11 +851,11 @@ bool ASTReader::ReadDeclContextStorage(ModuleFile &M,
Error("Expected visible lookup table block");
return true;
}
- Info.NameLookupTableData
- = ASTDeclContextNameLookupTable::Create(
- (const unsigned char *)Blob.data() + Record[0],
- (const unsigned char *)Blob.data(),
- ASTDeclContextNameLookupTrait(*this, M));
+ Info.NameLookupTableData = ASTDeclContextNameLookupTable::Create(
+ (const unsigned char *)Blob.data() + Record[0],
+ (const unsigned char *)Blob.data() + sizeof(uint32_t),
+ (const unsigned char *)Blob.data(),
+ ASTDeclContextNameLookupTrait(*this, M));
}
return false;
@@ -2509,10 +2509,11 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
unsigned Idx = 0;
serialization::DeclID ID = ReadDeclID(F, Record, Idx);
ASTDeclContextNameLookupTable *Table =
- ASTDeclContextNameLookupTable::Create(
- (const unsigned char *)Blob.data() + Record[Idx++],
- (const unsigned char *)Blob.data(),
- ASTDeclContextNameLookupTrait(*this, F));
+ ASTDeclContextNameLookupTable::Create(
+ (const unsigned char *)Blob.data() + Record[Idx++],
+ (const unsigned char *)Blob.data() + sizeof(uint32_t),
+ (const unsigned char *)Blob.data(),
+ ASTDeclContextNameLookupTrait(*this, F));
if (ID == PREDEF_DECL_TRANSLATION_UNIT_ID) { // Is it the TU?
DeclContext *TU = Context.getTranslationUnitDecl();
F.DeclContextInfos[TU].NameLookupTableData = Table;
@@ -2531,11 +2532,11 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
case IDENTIFIER_TABLE:
F.IdentifierTableData = Blob.data();
if (Record[0]) {
- F.IdentifierLookupTable
- = ASTIdentifierLookupTable::Create(
- (const unsigned char *)F.IdentifierTableData + Record[0],
- (const unsigned char *)F.IdentifierTableData,
- ASTIdentifierLookupTrait(*this, F));
+ F.IdentifierLookupTable = ASTIdentifierLookupTable::Create(
+ (const unsigned char *)F.IdentifierTableData + Record[0],
+ (const unsigned char *)F.IdentifierTableData + sizeof(uint32_t),
+ (const unsigned char *)F.IdentifierTableData,
+ ASTIdentifierLookupTrait(*this, F));
PP.getIdentifierTable().setExternalIdentifierLookup(this);
}
OpenPOWER on IntegriCloud