[cfe-dev] Fast enumeration syntax disables -checker-cfref

Nikita Zhuk nikita at zhuk.fi
Wed Sep 17 05:53:59 PDT 2008


There may have been a regression in static analyzer. When analyzing  
Objective-C methods which use the new Obj-C 2.0 'for' syntax (fast  
enumeration), CF reference count checker seems to ignore all leaks.  
I'm using clang rev 56242.

Here's a test case:

#import <Foundation/Foundation.h>
@interface MyClass : NSObject @end
@implementation MyClass
-(void)leakingMethod1 {
	NSLog(@"%@", [[NSString alloc] init]); // This is reported
-(void)leakingMethod2 {
	for (id obj in [NSArray array])
	NSLog(@"%@", [[NSString alloc] init]); // This is not reported

I've submitted this to bugzilla as bug 2798. Has anyone else  
encountered this problem?

More information about the cfe-dev mailing list