1 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -verify %s
2 // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify %s
4 typedef const struct __CFString * CFStringRef;
5 typedef const struct __CFAllocator * CFAllocatorRef;
6 typedef const struct __CFURL * CFURLRef;
7 extern CFURLRef CFURLCreateWithString(CFAllocatorRef allocator, CFStringRef URLString, CFURLRef baseURL);
8 typedef signed char BOOL;
9 @protocol NSObject - (BOOL)isEqual:(id)object; @end
10 @interface NSObject <NSObject> {} @end
11 @class NSArray, NSString, NSURL;
13 @interface NamingTest : NSObject {}
14 -(NSObject*)photocopy; // read as "photocopy"
15 -(NSObject*)photoCopy; // read as "photo Copy"
16 -(NSObject*)__blebPRCopy; // read as "bleb PRCopy"
17 -(NSObject*)__blebPRcopy; // read as "bleb P Rcopy"
18 -(NSObject*)new_theprefixdoescount; // read as "new theprefixdoescount"
19 -(NSObject*)newestAwesomeStuff; // read as "newest awesome stuff"
23 @interface MyClass : NSObject
27 - (NSURL *)myMethod:(NSString *)inString;
28 - (NSURL *)getMethod:(NSString*)inString;
29 - (void)addObject:(id)X;
32 @implementation MyClass
34 - (NSURL *)myMethod:(NSString *)inString
36 NSURL *url = (NSURL *)CFURLCreateWithString(0, (CFStringRef)inString, 0); // expected-warning{{leak}}
40 - (NSURL *)getMethod:(NSString *)inString
42 NSURL *url = (NSURL *)CFURLCreateWithString(0, (CFStringRef)inString, 0);
44 return url; // no-warning
47 void testNames(NamingTest* x) {
48 [x photocopy]; // no-warning
49 [x photoCopy]; // expected-warning{{leak}}
50 [x __blebPRCopy]; // expected-warning{{leak}}
51 [x __blebPRcopy]; // no-warning
52 [x new_theprefixdoescount]; // expected-warning{{leak}}
53 [x newestAwesomeStuff]; // no-warning
57 - (void)addObject:(id)X