From 96d2eecf85551906afb7736c4b9946024e8fcb3d Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 8 Dec 2008 21:44:15 +0000 Subject: [PATCH] 'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes . llvm-svn: 60717 --- clang/lib/Analysis/CheckObjCDealloc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp index a9e5675ce212..dda25017c34e 100644 --- a/clang/lib/Analysis/CheckObjCDealloc.cpp +++ b/clang/lib/Analysis/CheckObjCDealloc.cpp @@ -73,8 +73,11 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID, if(ObjCPropertyRefExpr* PRE = dyn_cast(BO->getLHS()->IgnoreParenCasts())) if(PRE->getProperty() == PD) - if(BO->getRHS()->isNullPointerConstant(Ctx)) - return true; + if(BO->getRHS()->isNullPointerConstant(Ctx)) { + // This is only a 'release' if the property kind is not + // 'assign'. + return PD->getSetterKind() != ObjCPropertyDecl::Assign;; + } // Recurse to children. for (Stmt::child_iterator I = S->child_begin(), E= S->child_end(); I!=E; ++I)