blob: 3a1b67ce218307d6f844bda5103296cd3a0703ef [file] [log] [blame]
Argyrios Kyrtzidis81eecde2011-11-04 15:58:17 +00001// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-gc-only %s
2// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-gc-only -x objective-c++ %s
Argyrios Kyrtzidisd8b42162012-01-12 02:34:32 +00003// DISABLE: mingw32
Argyrios Kyrtzidis81eecde2011-11-04 15:58:17 +00004
5#define CF_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
Argyrios Kyrtzidis1fe42032011-11-04 23:43:03 +00006typedef unsigned NSUInteger;
Argyrios Kyrtzidis81eecde2011-11-04 15:58:17 +00007typedef const void * CFTypeRef;
8CFTypeRef CFMakeCollectable(CFTypeRef cf) CF_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{unavailable}}
Argyrios Kyrtzidis1fe42032011-11-04 23:43:03 +00009void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options);
Argyrios Kyrtzidis81eecde2011-11-04 15:58:17 +000010
11void test1(CFTypeRef *cft) {
12 CFTypeRef c = CFMakeCollectable(cft); // expected-error {{CFMakeCollectable will leak the object that it receives in ARC}} \
13 // expected-error {{unavailable}}
Argyrios Kyrtzidis1fe42032011-11-04 23:43:03 +000014 NSAllocateCollectable(100, 0); // expected-error {{call returns pointer to GC managed memory; it will become unmanaged in ARC}}
Argyrios Kyrtzidis81eecde2011-11-04 15:58:17 +000015}
Argyrios Kyrtzidis280b4ad2011-11-06 18:58:23 +000016
17@interface I1 {
18 __strong void *gcVar; // expected-error {{GC managed memory will become unmanaged in ARC}}
19}
20@end;