[cfe-commits] r60717 - /cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp

Ted Kremenek kremenek at apple.com
Mon Dec 8 13:44:15 PST 2008


Author: kremenek
Date: Mon Dec  8 15:44:15 2008
New Revision: 60717

URL: http://llvm.org/viewvc/llvm-project?rev=60717&view=rev
Log:
'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'.  This fixes <rdar://problem/6380411>.

Modified:
    cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp

Modified: cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp?rev=60717&r1=60716&r2=60717&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp Mon Dec  8 15:44:15 2008
@@ -73,8 +73,11 @@
       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)





More information about the cfe-commits mailing list