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