1 // RUN: %clang_analyze_cc1 -analyze-function="-[Test1 myMethodWithY:withX:]" -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -verify %s
3 typedef signed char BOOL;
4 typedef unsigned int NSUInteger;
5 typedef struct _NSZone NSZone;
6 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
7 @protocol NSObject - (BOOL)isEqual:(id)object; @end
8 @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
9 @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
10 @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
11 @interface NSObject <NSObject> {}
18 @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
20 -(id)initWithFormat:(NSString *)f,...;
21 -(BOOL)isEqualToString:(NSString *)s;
25 @interface Test1 : NSObject {
29 -(id)myMethodWithY:(int)Y withX:(int)X;
31 @property (nonatomic, assign) NSString *text;
39 Test1 *cell = [[[Test1 alloc] init] autorelease];
41 NSString *string1 = [[NSString alloc] initWithFormat:@"test %f", 0.0]; // No warning: this function is not analyzed.
47 -(id)myMethodWithY:(int)Y withX:(int)X {
48 Test1 *cell = [[[Test1 alloc] init] autorelease];
50 NSString *string1 = [[NSString alloc] initWithFormat:@"test %f %d", 0.0, X+Y]; // expected-warning {{Potential leak}}