diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-23 22:11:07 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-23 22:11:07 +0000 |
commit | 97d095f4e53d97cd7a7eca4c69df6e9ee3878098 (patch) | |
tree | 0010492c4162f65aea078bc7396b05e979e7383d /lib/Analysis/CFRefCount.cpp | |
parent | 77a6be4826d1752ba834fddbbf3114f70cda2be5 (diff) |
Further cleanups to isTrackedObjectType().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 575a47b776..052a610db1 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -784,18 +784,22 @@ RetainSummaryManager::getPersistentSummary(ArgEffects* AE, RetEffect RetEff, // Predicates. //===----------------------------------------------------------------------===// -bool RetainSummaryManager::isTrackedObjectType(QualType T) { - if (!Ctx.isObjCObjectPointerType(T)) +bool RetainSummaryManager::isTrackedObjectType(QualType Ty) { + if (!Ctx.isObjCObjectPointerType(Ty)) return false; - // Does it subclass NSObject? - ObjCInterfaceType* OT = dyn_cast<ObjCInterfaceType>(T.getTypePtr()); + // We assume that id<..>, id, and "Class" all represent tracked objects. + const PointerType *PT = Ty->getAsPointerType(); + if (PT == 0) + return true; + + const ObjCInterfaceType *OT = PT->getPointeeType()->getAsObjCInterfaceType(); // We assume that id<..>, id, and "Class" all represent tracked objects. if (!OT) return true; - - // Does the object type subclass NSObject? + + // Does the interface subclass NSObject? // FIXME: We can memoize here if this gets too expensive. IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject"); ObjCInterfaceDecl* ID = OT->getDecl(); |