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 | 37467813c561870cb95c8ad9c07e2c0338e47e10 (patch) | |
tree | 60e46ad1130f035c1718dce14092f6623183e1cb /clang/lib/Analysis/CFRefCount.cpp | |
parent | 6f0f25b0d8d8cfb9019b6169c680d5812784b02e (diff) | |
download | bcm5719-llvm-37467813c561870cb95c8ad9c07e2c0338e47e10.tar.gz bcm5719-llvm-37467813c561870cb95c8ad9c07e2c0338e47e10.zip |
Further cleanups to isTrackedObjectType().
llvm-svn: 69929
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | clang/lib/Analysis/CFRefCount.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp index 575a47b7766..052a610db1b 100644 --- a/clang/lib/Analysis/CFRefCount.cpp +++ b/clang/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(); |