diff options
Diffstat (limited to 'clang/test/Analysis/CGColorSpace.c')
-rw-r--r-- | clang/test/Analysis/CGColorSpace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/Analysis/CGColorSpace.c b/clang/test/Analysis/CGColorSpace.c new file mode 100644 index 0000000..1bd20fa --- /dev/null +++ b/clang/test/Analysis/CGColorSpace.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify %s + +typedef struct CGColorSpace *CGColorSpaceRef; +extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); +extern CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space); +extern void CGColorSpaceRelease(CGColorSpaceRef space); + +void f() { + CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); // expected-warning{{leak}} + CGColorSpaceRetain(X); +} + +void fb() { + CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); + CGColorSpaceRetain(X); + CGColorSpaceRelease(X); + CGColorSpaceRelease(X); // no-warning +} |