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