aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-28 21:18:29 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-28 21:18:29 +0000
commita92193ebd9840e5ce4de1b09e49f1b024c0f5c2f (patch)
tree85d51c24d4fdf4ffdf76fed399f5c4fe5b4901b5 /lib/Frontend/PCHReader.cpp
parent13c8aa7a6c3605dd3c9588977b4809bb5128e6e0 (diff)
Implement a minor space optimization for the PCH identifier table,
which eliminates the storage for IdentifierInfo in the "uninteresting identifier" cases. Sadly, this only brought back 7k of the 500k we lost :( git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70325 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 8324f8de0b..64929dcb1d 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -220,6 +220,23 @@ public:
const unsigned char* d,
unsigned DataLen) {
using namespace clang::io;
+ pch::IdentID ID = ReadUnalignedLE32(d);
+ bool IsInteresting = ID & 0x01;
+
+ // Wipe out the "is interesting" bit.
+ ID = ID >> 1;
+
+ if (!IsInteresting) {
+ // For unintersting identifiers, just build the IdentifierInfo
+ // and associate it with the persistent ID.
+ IdentifierInfo *II = KnownII;
+ if (!II)
+ II = &Reader.getIdentifierTable().CreateIdentifierInfo(
+ k.first, k.first + k.second);
+ Reader.SetIdentifierInfo(ID, II);
+ return II;
+ }
+
uint32_t Bits = ReadUnalignedLE32(d);
bool CPlusPlusOperatorKeyword = Bits & 0x01;
Bits >>= 1;
@@ -233,8 +250,7 @@ public:
Bits >>= 10;
unsigned TokenID = Bits & 0xFF;
Bits >>= 8;
-
- pch::IdentID ID = ReadUnalignedLE32(d);
+
assert(Bits == 0 && "Extra bits in the identifier?");
DataLen -= 8;