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 7void 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// expected-note@arc-system-header.h:1 {{inline function performs a conversion which is forbidden in ARC}} 11// expected-note@arc-system-header.h:5 {{inline function performs a conversion which is forbidden in ARC}} 12} 13 14void test3(struct Test3 *p) { 15 p->field = 0; // expected-error {{'field' is unavailable in ARC}} 16 // expected-note@arc-system-header.h:14 {{declaration uses type that is ill-formed in ARC}} 17} 18 19void test4(Test4 *p) { 20 p->field1 = 0; // expected-error {{'field1' is unavailable in ARC}} 21 // expected-note@arc-system-header.h:19 {{declaration uses type that is ill-formed in ARC}} 22 p->field2 = 0; 23} 24 25void test5(struct Test5 *p) { 26 p->field = 0; // expected-error {{'field' is unavailable in ARC}} 27 // expected-note@arc-system-header.h:25 {{field has non-trivial ownership qualification}} 28} 29 30id 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 41void test7(Test7 *p) { 42 *p.prop = 0; // expected-error {{'prop' is unavailable in ARC}} 43 p.prop = 0; // expected-error {{'prop' is unavailable in ARC}} 44 *[p prop] = 0; // expected-error {{'prop' is unavailable in ARC}} 45 [p setProp: 0]; // expected-error {{'setProp:' is unavailable in ARC}} 46// expected-note@arc-system-header.h:41 4 {{declaration uses type that is ill-formed in ARC}} 47// expected-note@arc-system-header.h:41 2 {{property 'prop' is declared unavailable here}} 48} 49 50extern void doSomething(Test9 arg); 51void test9() { 52 Test9 foo2 = {0, 0}; // expected-error {{'field' is unavailable in ARC}} 53 // expected-note@arc-system-header.h:56 {{field has non-trivial ownership qualification}} 54 doSomething(foo2); 55} 56#endif 57 58// test8 in header 59