blob: 62d07ae122a77e83964262c5ce1c35dc9bb2ad29 [file] [log] [blame]
John McCallf85e1932011-06-15 23:02:42 +00001// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
2// RUN: %clang_cc1 -x objective-c++ -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8void *memset(void *, int, __SIZE_TYPE__);
9void *memmove(void *s1, const void *s2, __SIZE_TYPE__ n);
10void *memcpy(void *s1, const void *s2, __SIZE_TYPE__ n);
11
12#ifdef __cplusplus
13}
14#endif
15
16void test(id __strong *sip, id __weak *wip, id __autoreleasing *aip,
17 id __unsafe_unretained *uip, void *ptr) {
18 // All okay.
19 memset(sip, 0, 17);
20 memset(wip, 0, 17);
21 memset(aip, 0, 17);
22 memset(uip, 0, 17);
23
24 memcpy(sip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to lifetime-qualified type}} \
25 // expected-note{{explicitly cast the pointer to silence this warning}}
26 memcpy(wip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to lifetime-qualified type}} \
27 // expected-note{{explicitly cast the pointer to silence this warning}}
28 memcpy(aip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to lifetime-qualified type}} \
29 // expected-note{{explicitly cast the pointer to silence this warning}}
30 memcpy(uip, ptr, 17);
31
32 memcpy(ptr, sip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to lifetime-qualified type}} \
33 // expected-note{{explicitly cast the pointer to silence this warning}}
34 memcpy(ptr, wip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to lifetime-qualified type}} \
35 // expected-note{{explicitly cast the pointer to silence this warning}}
36 memcpy(ptr, aip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to lifetime-qualified type}} \
37 // expected-note{{explicitly cast the pointer to silence this warning}}
38 memcpy(ptr, uip, 17);
39
40 memmove(sip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to lifetime-qualified type}} \
41 // expected-note{{explicitly cast the pointer to silence this warning}}
42 memmove(wip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to lifetime-qualified type}} \
43 // expected-note{{explicitly cast the pointer to silence this warning}}
44 memmove(aip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to lifetime-qualified type}} \
45 // expected-note{{explicitly cast the pointer to silence this warning}}
46 memmove(uip, ptr, 17);
47
48 memmove(ptr, sip, 17); // expected-warning{{source of this 'memmove' call is a pointer to lifetime-qualified type}} \
49 // expected-note{{explicitly cast the pointer to silence this warning}}
50 memmove(ptr, wip, 17); // expected-warning{{source of this 'memmove' call is a pointer to lifetime-qualified type}} \
51 // expected-note{{explicitly cast the pointer to silence this warning}}
52 memmove(ptr, aip, 17); // expected-warning{{source of this 'memmove' call is a pointer to lifetime-qualified type}} \
53 // expected-note{{explicitly cast the pointer to silence this warning}}
54 memmove(ptr, uip, 17);
55}