aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/IdentifierTable.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-11 21:29:16 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-11 21:29:16 +0000
commit7e3a004c6ed1fe87912203b9c5a113f8da89d261 (patch)
tree1164db14751263371f56b858d1eb49d7ce2e4180 /include/clang/Basic/IdentifierTable.h
parent5b5c9ef865607e179413462dcd71bcebb5b7daae (diff)
PTH: Replace string identifier to persistent ID lookup with a hashtable. This is
actually *slightly* slower than the binary search. Since this is algorithmically better, further performance tuning should be able to make this faster. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r--include/clang/Basic/IdentifierTable.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 03533f87b9..27697df76c 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -83,24 +83,26 @@ public:
///
const char *getName() const {
if (Entry) return Entry->getKeyData();
+ // FIXME: This is gross. It would be best not to embed specific details
+ // of the PTH file format here.
// The 'this' pointer really points to a
// std::pair<IdentifierInfo, const char*>, where internal pointer
// points to the external string data.
- return ((std::pair<IdentifierInfo, const char*>*) this)->second + 4;
+ return ((std::pair<IdentifierInfo, const char*>*) this)->second;
}
/// getLength - Efficiently return the length of this identifier info.
///
unsigned getLength() const {
if (Entry) return Entry->getKeyLength();
+ // FIXME: This is gross. It would be best not to embed specific details
+ // of the PTH file format here.
// The 'this' pointer really points to a
// std::pair<IdentifierInfo, const char*>, where internal pointer
// points to the external string data.
- const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second;
- return ((unsigned) p[0])
- | (((unsigned) p[1]) << 8)
- | (((unsigned) p[2]) << 16)
- | (((unsigned) p[3]) << 24);
+ const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2;
+ return (((unsigned) p[0])
+ | (((unsigned) p[1]) << 8)) - 1;
}
/// hasMacroDefinition - Return true if this identifier is #defined to some