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
diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp
index 38736df..1f62721 100644
--- a/lib/Analysis/CheckObjCDealloc.cpp
+++ b/lib/Analysis/CheckObjCDealloc.cpp
@@ -47,10 +47,15 @@
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)