diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-11-10 02:11:55 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-11-10 02:11:55 +0000 |
| commit | 739156ab7c035a848e61e917ed0cfc1b20c2e231 (patch) | |
| tree | 032914f8a1e34a2a40728b5e748e65d520531f97 /clang/Basic/IdentifierTable.cpp | |
| parent | 11d700bfba2dadea1638a0468df2745b62a29087 (diff) | |
| download | bcm5719-llvm-739156ab7c035a848e61e917ed0cfc1b20c2e231.tar.gz bcm5719-llvm-739156ab7c035a848e61e917ed0cfc1b20c2e231.zip | |
Changed the serialization of IdentifierTable to only serialize out entries
that are referenced in the ASTs. This assumes that we serialize out the
decls/stmts first, and use the pointer-tracking logic in the Serializer to
determine if an IdentifierInfo (or its string key) is ever referenced.
This is a significant space optimization for serialized ASTs.
Consider the following program:
void foo(int x,int y) {
return x > y ? x : y+1;
}
Here are the sizes of the files for the serialized ASTs:
Full IdentifierTable: 23676 bytes
Only-referenced Identifiers: 304 bytes.
For this simple program, this is a 77% reduction in the file size of the
serialized ASTs.
llvm-svn: 43975
Diffstat (limited to 'clang/Basic/IdentifierTable.cpp')
| -rw-r--r-- | clang/Basic/IdentifierTable.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/Basic/IdentifierTable.cpp b/clang/Basic/IdentifierTable.cpp index 48fb0868524..f7f008220ff 100644 --- a/clang/Basic/IdentifierTable.cpp +++ b/clang/Basic/IdentifierTable.cpp @@ -415,8 +415,8 @@ void IdentifierTable::Emit(llvm::Serializer& S) const { const char* Key = I->getKeyData(); const IdentifierInfo* Info = &I->getValue(); - bool KeyRegistered = true; // FIXME: S.isRegistered(Key); - bool InfoRegistered = true; // FIXME: S.isRegistered(Info); + bool KeyRegistered = S.isRegistered(Key); + bool InfoRegistered = S.isRegistered(Info); if (KeyRegistered || InfoRegistered) { // These acrobatics are so that we don't incur the cost of registering |

