summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-06-24 03:49:48 +0000
committerTed Kremenek <kremenek@apple.com>2008-06-24 03:49:48 +0000
commitb1d1329ac737671e7addd34117cfe753bf2cb7a0 (patch)
treeabd491cb6b6154f0cf24f759948a1b417a2ed7b7 /clang/lib/Analysis/CFRefCount.cpp
parent675a6e6dface80c6be68d903ceba78d1bc8c749c (diff)
downloadbcm5719-llvm-b1d1329ac737671e7addd34117cfe753bf2cb7a0.tar.gz
bcm5719-llvm-b1d1329ac737671e7addd34117cfe753bf2cb7a0.zip
Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.
llvm-svn: 52667
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index aafef03a5f2..d1d58cb9090 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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<ObjCSummaryKey> {
static inline ObjCSummaryKey getEmptyKey() {
- return ObjCSummaryKey(DenseMapInfo<ObjCInterfaceDecl*>::getEmptyKey(),
+ return ObjCSummaryKey(DenseMapInfo<IdentifierInfo*>::getEmptyKey(),
DenseMapInfo<Selector>::getEmptyKey());
}
static inline ObjCSummaryKey getTombstoneKey() {
- return ObjCSummaryKey(DenseMapInfo<ObjCInterfaceDecl*>::getTombstoneKey(),
+ return ObjCSummaryKey(DenseMapInfo<IdentifierInfo*>::getTombstoneKey(),
DenseMapInfo<Selector>::getTombstoneKey());
}
static unsigned getHashValue(const ObjCSummaryKey &V) {
- return
- (DenseMapInfo<ObjCInterfaceDecl*>::getHashValue(V.getDecl())&0x88888888)
- |(DenseMapInfo<Selector>::getHashValue(V.getSelector()) & 0x55555555);
+ return (DenseMapInfo<IdentifierInfo*>::getHashValue(V.getIdentifier())
+ & 0x88888888)
+ | (DenseMapInfo<Selector>::getHashValue(V.getSelector())
+ & 0x55555555);
}
static bool isEqual(const ObjCSummaryKey& LHS, const ObjCSummaryKey& RHS) {
- return
- DenseMapInfo<ObjCInterfaceDecl*>::isEqual(LHS.getDecl(), RHS.getDecl())
- && DenseMapInfo<Selector>::isEqual(LHS.getSelector(),RHS.getSelector());
+ return DenseMapInfo<IdentifierInfo*>::isEqual(LHS.getIdentifier(),
+ RHS.getIdentifier()) &&
+ DenseMapInfo<Selector>::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) ];
}
};
OpenPOWER on IntegriCloud