summaryrefslogtreecommitdiffstats
path: root/test/Analysis/CGColorSpace.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/Analysis/CGColorSpace.c
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'test/Analysis/CGColorSpace.c')
-rw-r--r--test/Analysis/CGColorSpace.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c
new file mode 100644
index 0000000..2887d47
--- /dev/null
+++ b/test/Analysis/CGColorSpace.c
@@ -0,0 +1,21 @@
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s &&
+// RUN: clang-cc -analyze -checker-cfref -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
+}
OpenPOWER on IntegriCloud