1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=basic -verify %s 2 // RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify %s 3 4 typedef struct CGColorSpace *CGColorSpaceRef; 5 extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); 6 extern CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space); 7 extern void CGColorSpaceRelease(CGColorSpaceRef space); 8 9 void f() { 10 CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); // expected-warning{{leak}} 11 CGColorSpaceRetain(X); 12 } 13 14 void fb() { 15 CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); 16 CGColorSpaceRetain(X); 17 CGColorSpaceRelease(X); 18 CGColorSpaceRelease(X); // no-warning 19 } 20