summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-28 20:01:51 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-28 20:01:51 +0000
commitab4df58193b60455286db0cd4ad3e67b535cd3d6 (patch)
tree9c17b48790d655be5f6ca8cdb410472dad05fccb /clang/lib/Frontend/PCHReader.cpp
parent3d948164f7319e3e45d40831ba9e73ce9f44f230 (diff)
downloadbcm5719-llvm-ab4df58193b60455286db0cd4ad3e67b535cd3d6.tar.gz
bcm5719-llvm-ab4df58193b60455286db0cd4ad3e67b535cd3d6.zip
Revert r70075 and r70078, which reorganized the PCH on-disk hash table
for identifiers to separate "interesting" from "uninteresting" identifiers. However, to cope with compiler invocations where the predefines buffers mismatch, we need to be able to search the complete identifier table. Cocoa.h.pch is now about 500k larger that it used to be :( llvm-svn: 70320
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r--clang/lib/Frontend/PCHReader.cpp49
1 files changed, 8 insertions, 41 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index df9f301f791..f1d7e7a5586 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -1943,47 +1943,14 @@ IdentifierInfo *PCHReader::DecodeIdentifierInfo(unsigned ID) {
uint32_t Offset = IdentifierOffsets[ID - 1];
const char *Str = IdentifierTableData + Offset;
- // If there is an identifier lookup table, but the offset of this
- // string is after the identifier table itself, then we know that
- // this string is not in the on-disk hash table. Therefore,
- // disable lookup into the hash table when looking for this
- // identifier.
- PCHIdentifierLookupTable *IdTable
- = (PCHIdentifierLookupTable *)IdentifierLookupTable;
- if (!IdTable ||
- Offset >= uint32_t(IdTable->getBuckets() - IdTable->getBase())) {
- // Turn off lookup into the on-disk hash table. We know that
- // this identifier is not there.
- if (IdTable)
- PP.getIdentifierTable().setExternalIdentifierLookup(0);
-
- // All of the strings in the PCH file are preceded by a 16-bit
- // length. Extract that 16-bit length to avoid having to execute
- // strlen().
- const char *StrLenPtr = Str - 2;
- unsigned StrLen = (((unsigned) StrLenPtr[0])
- | (((unsigned) StrLenPtr[1]) << 8)) - 1;
- IdentifiersLoaded[ID - 1]=&PP.getIdentifierTable().get(Str, Str + StrLen);
-
- // Turn on lookup into the on-disk hash table, if we have an
- // on-disk hash table.
- if (IdTable)
- PP.getIdentifierTable().setExternalIdentifierLookup(this);
- } else {
- // The identifier is a key in our on-disk hash table. Since we
- // know where the hash table entry starts, just read in this
- // (key, value) pair.
- PCHIdentifierLookupTrait Trait(const_cast<PCHReader &>(*this));
- const unsigned char *Pos = (const unsigned char *)Str - 4;
- std::pair<unsigned, unsigned> KeyDataLengths
- = Trait.ReadKeyDataLength(Pos);
-
- PCHIdentifierLookupTrait::internal_key_type InternalKey
- = Trait.ReadKey(Pos, KeyDataLengths.first);
- Pos = (const unsigned char *)Str + KeyDataLengths.first;
- IdentifiersLoaded[ID - 1] = Trait.ReadData(InternalKey, Pos,
- KeyDataLengths.second);
- }
+ // All of the strings in the PCH file are preceded by a 16-bit
+ // length. Extract that 16-bit length to avoid having to execute
+ // strlen().
+ const char *StrLenPtr = Str - 2;
+ unsigned StrLen = (((unsigned) StrLenPtr[0])
+ | (((unsigned) StrLenPtr[1]) << 8)) - 1;
+ IdentifiersLoaded[ID - 1]
+ = &PP.getIdentifierTable().get(Str, Str + StrLen);
}
return IdentifiersLoaded[ID - 1];
OpenPOWER on IntegriCloud