brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 62fceec Raw
57 lines · plain
1// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE2// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify3 4#include <arc-system-header.h>5 6#ifndef NO_USE7void 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;27}28 29id 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 40void 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// expected-note@arc-system-header.h:41 4 {{declaration uses type that is ill-formed in ARC}}46// expected-note@arc-system-header.h:41 2 {{property 'prop' is declared unavailable here}}47}48 49extern void doSomething(Test9 arg);50void test9(void) {51    Test9 foo2 = {0, 0};52    doSomething(foo2);53}54#endif55 56// test8 in header57