From 68072a7f22bf73a3d75b6d1e7bf08ebc4d7a4781 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 1 Dec 2007 04:43:17 +0000 Subject: [PATCH] Fixed bug in the serialization of SelectorTable where we did not register the pointer of MultiKeywordSelectors. Added optimization to the serialization of SelectorTable where we only serialize out MultiKeywordSelectors that are ever referenced by an object other than the SelectorTable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44483 91177308-0d34-0410-b5e6-96231b3b80d8 --- Basic/IdentifierTable.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Basic/IdentifierTable.cpp b/Basic/IdentifierTable.cpp index 5459d609c3..3d1ef1fbe5 100644 --- a/Basic/IdentifierTable.cpp +++ b/Basic/IdentifierTable.cpp @@ -507,7 +507,12 @@ void SelectorTable::Emit(llvm::Serializer& S) const { S.EmitPtr(this); for (iterator I=SelTab->begin(), E=SelTab->end(); I != E; ++I) { + if (!S.isRegistered(&*I)) + continue; + S.FlushRecord(); // Start a new record. + + S.EmitPtr(&*I); S.EmitInt(I->getNumArgs()); for (MultiKeywordSelector::keyword_iterator KI = I->keyword_begin(), @@ -528,6 +533,8 @@ SelectorTable* SelectorTable::CreateAndRegister(llvm::Deserializer& D) { *static_cast*>(t->Impl); while (!D.FinishedBlock(BLoc)) { + + llvm::SerializedPtrID PtrID = D.ReadPtrID(); unsigned nKeys = D.ReadInt(); MultiKeywordSelector *SI = @@ -535,6 +542,8 @@ SelectorTable* SelectorTable::CreateAndRegister(llvm::Deserializer& D) { nKeys*sizeof(IdentifierInfo *)); new (SI) MultiKeywordSelector(nKeys); + + D.RegisterPtr(PtrID,SI); IdentifierInfo **KeyInfo = reinterpret_cast(SI+1); -- 2.50.1