From 53301ba984f7691dcada8802467ddd93c2dd1702 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 24 Jun 2008 03:49:48 +0000 Subject: [PATCH] Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52667 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CFRefCount.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index aafef03a5f..d1d58cb909 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -218,12 +218,19 @@ public: namespace { class VISIBILITY_HIDDEN ObjCSummaryKey { - ObjCInterfaceDecl* D; + IdentifierInfo* II; Selector S; public: - ObjCSummaryKey(ObjCInterfaceDecl* d, Selector s) : D(d), S(s) {} + ObjCSummaryKey(IdentifierInfo* ii, Selector s) + : II(ii), S(s) {} + + ObjCSummaryKey(ObjCInterfaceDecl* d, Selector s) + : II(d ? d->getIdentifier() : 0), S(s) {} + + ObjCSummaryKey(Selector s) + : II(0), S(s) {} - ObjCInterfaceDecl* getDecl() const { return D; } + IdentifierInfo* getIdentifier() const { return II; } Selector getSelector() const { return S; } }; } @@ -231,25 +238,27 @@ namespace { namespace llvm { template <> struct DenseMapInfo { static inline ObjCSummaryKey getEmptyKey() { - return ObjCSummaryKey(DenseMapInfo::getEmptyKey(), + return ObjCSummaryKey(DenseMapInfo::getEmptyKey(), DenseMapInfo::getEmptyKey()); } static inline ObjCSummaryKey getTombstoneKey() { - return ObjCSummaryKey(DenseMapInfo::getTombstoneKey(), + return ObjCSummaryKey(DenseMapInfo::getTombstoneKey(), DenseMapInfo::getTombstoneKey()); } static unsigned getHashValue(const ObjCSummaryKey &V) { - return - (DenseMapInfo::getHashValue(V.getDecl())&0x88888888) - |(DenseMapInfo::getHashValue(V.getSelector()) & 0x55555555); + return (DenseMapInfo::getHashValue(V.getIdentifier()) + & 0x88888888) + | (DenseMapInfo::getHashValue(V.getSelector()) + & 0x55555555); } static bool isEqual(const ObjCSummaryKey& LHS, const ObjCSummaryKey& RHS) { - return - DenseMapInfo::isEqual(LHS.getDecl(), RHS.getDecl()) - && DenseMapInfo::isEqual(LHS.getSelector(),RHS.getSelector()); + return DenseMapInfo::isEqual(LHS.getIdentifier(), + RHS.getIdentifier()) && + DenseMapInfo::isEqual(LHS.getSelector(), + RHS.getSelector()); } static bool isPod() { @@ -324,7 +333,7 @@ class RetainSummaryManager { } RetainSummary*& operator[](Selector S) { - return M[ ObjCSummaryKey(0,S) ]; + return M[ ObjCSummaryKey(S) ]; } }; -- 2.40.0