diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-08 21:44:15 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-08 21:44:15 +0000 |
commit | 2c615660ec96fbce0c36216c2f6cb83d52267a6c (patch) | |
tree | a1ff758997e5d6351292aab0487bb6a2171eaadb /lib/Analysis/CheckObjCDealloc.cpp | |
parent | b79c01ea321687d8b9e82968395f30c5c261a6b0 (diff) |
'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes <rdar://problem/6380411>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CheckObjCDealloc.cpp')
-rw-r--r-- | lib/Analysis/CheckObjCDealloc.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp index a9e5675ce2..dda25017c3 100644 --- a/lib/Analysis/CheckObjCDealloc.cpp +++ b/lib/Analysis/CheckObjCDealloc.cpp @@ -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) |