File: arc-system-header.m

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (56 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE
// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify

#include <arc-system-header.h>

#ifndef NO_USE
void test(id op, void *cp) {
  cp = test0(op); // expected-error {{'test0' is unavailable in ARC}}
  cp = *test1(&op); // expected-error {{'test1' is unavailable in ARC}}
// expected-note@arc-system-header.h:1 {{inline function performs a conversion which is forbidden in ARC}}
// expected-note@arc-system-header.h:5 {{inline function performs a conversion which is forbidden in ARC}}
}

void test3(struct Test3 *p) {
  p->field = 0; // expected-error {{'field' is unavailable in ARC}}
                // expected-note@arc-system-header.h:14 {{declaration uses type that is ill-formed in ARC}}
}

void test4(Test4 *p) {
  p->field1 = 0; // expected-error {{'field1' is unavailable in ARC}}
                 // expected-note@arc-system-header.h:19 {{declaration uses type that is ill-formed in ARC}}
  p->field2 = 0;
}

void test5(struct Test5 *p) {
  p->field = 0;
}

id test6(void) {
  // This is actually okay to use if declared in a system header.
  id x;
  x = (id) kMagicConstant;
  x = (id) (x ? kMagicConstant : kMagicConstant);
  x = (id) (x ? kMagicConstant : (void*) 0);

  extern void test6_helper(void);
  x = (id) (test6_helper(), kMagicConstant);
}

void test7(Test7 *p) {
  *p.prop = 0; // expected-error {{'prop' is unavailable in ARC}}
  p.prop = 0; // expected-error {{'prop' is unavailable in ARC}}
  *[p prop] = 0; // expected-error {{'prop' is unavailable in ARC}}
  [p setProp: 0]; // expected-error {{'setProp:' is unavailable in ARC}}
// expected-note@arc-system-header.h:41 4 {{declaration uses type that is ill-formed in ARC}}
// expected-note@arc-system-header.h:41 2 {{property 'prop' is declared unavailable here}}
}

extern void doSomething(Test9 arg);
void test9(void) {
    Test9 foo2 = {0, 0};
    doSomething(foo2);
}
#endif

// test8 in header