[cfe-commits] r52667 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Mon Jun 23 20:49:49 PDT 2008


Author: kremenek
Date: Mon Jun 23 22:49:48 2008
New Revision: 52667

URL: http://llvm.org/viewvc/llvm-project?rev=52667&view=rev
Log:
Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=52667&r1=52666&r2=52667&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Mon Jun 23 22:49:48 2008
@@ -218,12 +218,19 @@
 
 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 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 @@
     }
     
     RetainSummary*& operator[](Selector S) {
-      return M[ ObjCSummaryKey(0,S) ];
+      return M[ ObjCSummaryKey(S) ];
     }    
   };
   





More information about the cfe-commits mailing list