aboutsummaryrefslogtreecommitdiff
path: root/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
commitaeca9637ce88da7f2ee7c0edba3d34f14a2c3015 (patch)
treeff342d7d0ce30b98eb40c12404714321347a2e77 /lib/Analysis/CheckObjCDealloc.cpp
parenta0fb5861dec7aa1da0d21d5759678d76b00464f4 (diff)
Skip the "-dealloc" check if a ObjC class contains no ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53100 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CheckObjCDealloc.cpp')
-rw-r--r--lib/Analysis/CheckObjCDealloc.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp
index 38736dff3d..1f627216ef 100644
--- a/lib/Analysis/CheckObjCDealloc.cpp
+++ b/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)