summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-03 15:37:02 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-03 15:37:02 +0000
commit68b117fca416c82a63a37a346656ee5eb4c0b667 (patch)
tree33adcf8a3c565d1b14e56389288e75b58e583800 /clang/lib/Analysis/CheckObjCDealloc.cpp
parentb23c3aaf7a0767f083aa9f164da79fab94b072ba (diff)
downloadbcm5719-llvm-68b117fca416c82a63a37a346656ee5eb4c0b667.tar.gz
bcm5719-llvm-68b117fca416c82a63a37a346656ee5eb4c0b667.zip
Skip the "-dealloc" check if a ObjC class contains no ivars.
llvm-svn: 53100
Diffstat (limited to 'clang/lib/Analysis/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/Analysis/CheckObjCDealloc.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp
index 38736dff3de..1f627216ef5 100644
--- a/clang/lib/Analysis/CheckObjCDealloc.cpp
+++ b/clang/lib/Analysis/CheckObjCDealloc.cpp
@@ -47,10 +47,15 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D,
assert (LOpts.getGCMode() != LangOptions::GCOnly);
ASTContext& Ctx = BR.getContext();
-
+ ObjCInterfaceDecl* ID = D->getClassInterface();
+
+ // Does the class contain any ivars? If not, skip the check entirely.
+
+ if (ID->ivar_empty())
+ return;
+
// Determine if the class subclasses NSObject.
IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
- ObjCInterfaceDecl* ID = D->getClassInterface();
for ( ; ID ; ID = ID->getSuperClass())
if (ID->getIdentifier() == NSObjectII)
OpenPOWER on IntegriCloud