aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-03-29 00:32:36 +0000
committerTed Kremenek <kremenek@apple.com>2013-03-29 00:32:36 +0000
commit84e480447a20a8a5ed9ee561c8901475f0a4fd9c (patch)
tree532bd70b8595d6101e713fee2cbccac76b246c47
parentdff2be8ba441f5c61af8444479f7133b22dcfcf4 (diff)
[analyzer] Add static initializer test case (from <rdar://problem/13227740>).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178321 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/retain-release.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Analysis/retain-release.mm b/test/Analysis/retain-release.mm
index d92237b185..47d67eae1b 100644
--- a/test/Analysis/retain-release.mm
+++ b/test/Analysis/retain-release.mm
@@ -64,6 +64,8 @@ extern const CFArrayCallBacks kCFTypeArrayCallBacks;
typedef const struct __CFArray * CFArrayRef;
typedef struct __CFArray * CFMutableArrayRef;
extern CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFArrayCallBacks *callBacks);
+void abort(void) __attribute__((noreturn));
+CFArrayRef CFArrayCreate(CFAllocatorRef allocator, const void **values, CFIndex numValues, const CFArrayCallBacks *callBacks);
extern const void *CFArrayGetValueAtIndex(CFArrayRef theArray, CFIndex idx);
extern void CFArrayAppendValue(CFMutableArrayRef theArray, const void *value);
typedef struct {
@@ -385,3 +387,24 @@ void testCallback() {
val >> process;
}
+//===----------------------------------------------------------------------===//
+// Test handling static initializers.
+//===----------------------------------------------------------------------===//
+
+@interface radar13227740 : NSObject
+@end
+
+@implementation radar13227740
+- (CFArrayRef)test {
+ static CFArrayRef array = ::CFArrayCreate(0, 0, 0, 0);
+ do { if (!((0 != array)/1)) { abort(); } } while (false);
+ return array;
+}
+
+// Previously this reported a bogus leak.
+- (void)test2 {
+ (void)[self test];
+ (void)[self test];
+}
+@end
+