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

Nikita Zhuk nikita at zhuk.fi
Mon Oct 27 05:55:36 PDT 2008

On 25.10.2008, at 5.55, Ted Kremenek wrote:

> 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.

Actually, I found one deficiency in my patch but I'm not sure how to  
fix it. Since I'm only interested in checking 'release' messages sent  
to ivars of 'readwrite' properties, I check if PD->isReadOnly()  
returns true. However, if a property is declared as 'readonly' in  
@interface and then redeclared later as 'readwrite' (in a class  
extension or in a protocol), PD->isReadOnly() still returns true and  
some potentially missing releases are not catched by my check. Is  
there some reusable code in clang which would take property attribute  
overriding into account and give the the "final" set of attributes, or  
should I write class extension / protocol property lookup myself?

More information about the cfe-dev mailing list