John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE |
| 2 | // RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 3 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 4 | #include <arc-system-header.h> |
| 5 | |
| 6 | #ifndef NO_USE |
| 7 | void test(id op, void *cp) { |
| 8 | cp = test0(op); // expected-error {{'test0' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}} |
| 9 | cp = *test1(&op); // expected-error {{'test1' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 10 | // expected-note@arc-system-header.h:1 {{marked unavailable here}} |
| 11 | // expected-note@arc-system-header.h:5 {{marked unavailable here}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 12 | } |
| 13 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 14 | void test3(struct Test3 *p) { |
| 15 | p->field = 0; // expected-error {{'field' is unavailable: this system declaration uses an unsupported type}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 16 | // expected-note@arc-system-header.h:14 {{marked unavailable here}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 17 | } |
| 18 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 19 | void test4(Test4 *p) { |
| 20 | p->field1 = 0; // expected-error {{'field1' is unavailable: this system declaration uses an unsupported type}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 21 | // expected-note@arc-system-header.h:19 {{marked unavailable here}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 22 | p->field2 = 0; |
| 23 | } |
| 24 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 25 | void test5(struct Test5 *p) { |
Argyrios Kyrtzidis | b8b0313 | 2011-06-24 00:08:59 +0000 | [diff] [blame] | 26 | p->field = 0; // expected-error {{'field' is unavailable: this system field has retaining ownership}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 27 | // expected-note@arc-system-header.h:25 {{marked unavailable here}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | id test6() { |
| 31 | // This is actually okay to use if declared in a system header. |
| 32 | id x; |
| 33 | x = (id) kMagicConstant; |
| 34 | x = (id) (x ? kMagicConstant : kMagicConstant); |
| 35 | x = (id) (x ? kMagicConstant : (void*) 0); |
| 36 | |
| 37 | extern void test6_helper(); |
| 38 | x = (id) (test6_helper(), kMagicConstant); |
| 39 | } |
| 40 | |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 41 | void test7(Test7 *p) { |
| 42 | *p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}} |
| 43 | p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}} |
| 44 | *[p prop] = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}} |
| 45 | [p setProp: 0]; // expected-error {{'setProp:' is unavailable: this system declaration uses an unsupported type}} |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 46 | // expected-note@arc-system-header.h:41 4 {{marked unavailable here}} |
| 47 | // expected-note@arc-system-header.h:41 2 {{property 'prop' is declared unavailable here}} |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 48 | } |
| 49 | #endif |
John McCall | b64915a | 2011-06-17 21:56:12 +0000 | [diff] [blame] | 50 | |
| 51 | // test8 in header |