[cfe-dev] [PATCH] Check missing or extra releases of ivars in dealloc

Ted Kremenek kremenek at apple.com
Fri Oct 24 19:55:14 PDT 2008

On Oct 24, 2008, at 8:17 AM, Nikita Zhuk wrote:

> Hi,
> The attached patch adds additional checks to -warn-objc-missing- 
> dealloc. It checks that all ivars which are used in implementation  
> of synthesized properties are either
> a) released in dealloc if the property has retain" or "copy"  
> attribute OR
> b) not released in dealloc if the property has "assign" attribute
> If it looks useful to you, please review & include it into clang.

Hi Nikita,

Overall this patch looks really great.  At some point it would be good  
for it to utilize the logic from the retain/release checker to see if  
an ivar has been released instead of walking the AST to see if an ivar  
has been passed a 'release' message.  Not only will this allow us to  
handle the many edge cases with syntax (e.g., casts, parentheses,  
etc.), it will also allow us to determine if a -dealloc implementation  
correctly releases an ivar along every path, etc.

If you don't mind waiting just a bit, I'm going to test drive these  
checks over some large Objective-C projects to see what kind of  
results it gets!


More information about the cfe-dev mailing list