annotate clang/test/SemaObjC/arc-non-pod-memaccess.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 #ifdef __cplusplus
anatofuz
parents:
diff changeset
5 extern "C" {
anatofuz
parents:
diff changeset
6 #endif
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 void *memset(void *, int, __SIZE_TYPE__);
anatofuz
parents:
diff changeset
9 void *memmove(void *s1, const void *s2, __SIZE_TYPE__ n);
anatofuz
parents:
diff changeset
10 void *memcpy(void *s1, const void *s2, __SIZE_TYPE__ n);
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 #ifdef __cplusplus
anatofuz
parents:
diff changeset
13 }
anatofuz
parents:
diff changeset
14 #endif
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 void test(id __strong *sip, id __weak *wip, id __autoreleasing *aip,
anatofuz
parents:
diff changeset
17 id __unsafe_unretained *uip, void *ptr) {
anatofuz
parents:
diff changeset
18 // All okay.
anatofuz
parents:
diff changeset
19 memset(sip, 0, 17);
anatofuz
parents:
diff changeset
20 memset(wip, 0, 17);
anatofuz
parents:
diff changeset
21 memset(aip, 0, 17);
anatofuz
parents:
diff changeset
22 memset(uip, 0, 17);
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 memcpy(sip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
25 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
26 memcpy(wip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
27 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
28 memcpy(aip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
29 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
30 memcpy(uip, ptr, 17);
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 memcpy(ptr, sip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
33 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
34 memcpy(ptr, wip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
35 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
36 memcpy(ptr, aip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
37 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
38 memcpy(ptr, uip, 17);
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 memmove(sip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
41 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
42 memmove(wip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
43 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
44 memmove(aip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
45 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
46 memmove(uip, ptr, 17);
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 memmove(ptr, sip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
49 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
50 memmove(ptr, wip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
51 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
52 memmove(ptr, aip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \
anatofuz
parents:
diff changeset
53 // expected-note{{explicitly cast the pointer to silence this warning}}
anatofuz
parents:
diff changeset
54 memmove(ptr, uip, 17);
anatofuz
parents:
diff changeset
55 }
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 void rdar9772982(int i, ...) {
anatofuz
parents:
diff changeset
58 __builtin_va_list ap;
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 __builtin_va_start(ap, i);
anatofuz
parents:
diff changeset
61 __builtin_va_arg(ap, __strong id); // expected-error{{second argument to 'va_arg' is of ARC ownership-qualified type '__strong id'}}
anatofuz
parents:
diff changeset
62 __builtin_va_end(ap);
anatofuz
parents:
diff changeset
63 }