1// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s 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 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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-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 ownership-qualified type}} \ 53 // expected-note{{explicitly cast the pointer to silence this warning}} 54 memmove(ptr, uip, 17); 55} 56 57void rdar9772982(int i, ...) { 58 __builtin_va_list ap; 59 60 __builtin_va_start(ap, i); 61 __builtin_va_arg(ap, __strong id); // expected-error{{second argument to 'va_arg' is of ARC ownership-qualified type '__strong id'}} 62 __builtin_va_end(ap); 63} 64