[LLVMbugs] [Bug 7309] New: Objective-C: Retain-count analysis with property assignment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 5 08:00:55 PDT 2010


           Summary: Objective-C: Retain-count analysis with property
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: remy.demarest at gmail.com
                CC: llvmbugs at cs.uiuc.edu

This is a bug concerning the dot-syntax assignment with properties:

The following bug should make the CSA display the same diagnosis for both
assignments, it only displays one for the method call and not for the property


#import <Foundation/Foundation.h>

@interface MyClass : NSObject
// retain or assign doesn't change anything
@property(nonatomic, retain) id prop;

int main(int argc, char **argv)
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    MyClass *obj = [[[MyClass alloc] init] autorelease];

    // This line triggers a possible leak diagnosis
    [obj setProp:[[NSObject alloc] init]];

    // This line is strictly equivalent but doesn't trigger the leak diagnosis
    obj.prop = [[NSObject alloc] init];

    [pool drain];
    return 0;

@implementation MyClass
@synthesize prop;

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list