'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes <rdar://problem/6380411>.

llvm-svn: 60717
This commit is contained in:
Ted Kremenek 2008-12-08 21:44:15 +00:00
parent 5fd31b17df
commit 96d2eecf85
1 changed files with 5 additions and 2 deletions

View File

@ -73,8 +73,11 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
if(ObjCPropertyRefExpr* PRE =
dyn_cast<ObjCPropertyRefExpr>(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)