| 1 |
// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE |
| 2 |
// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify |
| 3 |
|
| 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 in ARC}} |
| 9 |
cp = *test1(&op); // expected-error {{'test1' is unavailable in ARC}} |
| 10 |
// [email protected]:1 {{inline function performs a conversion which is forbidden in ARC}} |
| 11 |
// [email protected]:5 {{inline function performs a conversion which is forbidden in ARC}} |
| 12 |
} |
| 13 |
|
| 14 |
void test3(struct Test3 *p) { |
| 15 |
p->field = 0; // expected-error {{'field' is unavailable in ARC}} |
| 16 |
// [email protected]:14 {{declaration uses type that is ill-formed in ARC}} |
| 17 |
} |
| 18 |
|
| 19 |
void test4(Test4 *p) { |
| 20 |
p->field1 = 0; // expected-error {{'field1' is unavailable in ARC}} |
| 21 |
// [email protected]:19 {{declaration uses type that is ill-formed in ARC}} |
| 22 |
p->field2 = 0; |
| 23 |
} |
| 24 |
|
| 25 |
void test5(struct Test5 *p) { |
| 26 |
p->field = 0; |
| 27 |
} |
| 28 |
|
| 29 |
id test6(void) { |
| 30 |
// This is actually okay to use if declared in a system header. |
| 31 |
id x; |
| 32 |
x = (id) kMagicConstant; |
| 33 |
x = (id) (x ? kMagicConstant : kMagicConstant); |
| 34 |
x = (id) (x ? kMagicConstant : (void*) 0); |
| 35 |
|
| 36 |
extern void test6_helper(void); |
| 37 |
x = (id) (test6_helper(), kMagicConstant); |
| 38 |
} |
| 39 |
|
| 40 |
void test7(Test7 *p) { |
| 41 |
*p.prop = 0; // expected-error {{'prop' is unavailable in ARC}} |
| 42 |
p.prop = 0; // expected-error {{'prop' is unavailable in ARC}} |
| 43 |
*[p prop] = 0; // expected-error {{'prop' is unavailable in ARC}} |
| 44 |
[p setProp: 0]; // expected-error {{'setProp:' is unavailable in ARC}} |
| 45 |
// [email protected]:41 4 {{declaration uses type that is ill-formed in ARC}} |
| 46 |
// [email protected]:41 2 {{property 'prop' is declared unavailable here}} |
| 47 |
} |
| 48 |
|
| 49 |
extern void doSomething(Test9 arg); |
| 50 |
void test9(void) { |
| 51 |
Test9 foo2 = {0, 0}; |
| 52 |
doSomething(foo2); |
| 53 |
} |
| 54 |
#endif |
| 55 |
|
| 56 |
// test8 in header |