summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-12-08 21:44:15 +0000
committerTed Kremenek <kremenek@apple.com>2008-12-08 21:44:15 +0000
commit96d2eecf85551906afb7736c4b9946024e8fcb3d (patch)
tree255a76de416f8ae9d086e8e74425b54f74fea9d7 /clang/lib/Analysis/CheckObjCDealloc.cpp
parent5fd31b17df35c03b963861c934d3c3690732b42e (diff)
downloadbcm5719-llvm-96d2eecf85551906afb7736c4b9946024e8fcb3d.tar.gz
bcm5719-llvm-96d2eecf85551906afb7736c4b9946024e8fcb3d.zip
'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes <rdar://problem/6380411>.
llvm-svn: 60717
Diffstat (limited to 'clang/lib/Analysis/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/Analysis/CheckObjCDealloc.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp
index a9e5675ce21..dda25017c34 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<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)
OpenPOWER on IntegriCloud