1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s 2*67e74705SXin Li// 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*67e74705SXin Li 4*67e74705SXin Li#ifdef __cplusplus 5*67e74705SXin Liextern "C" { 6*67e74705SXin Li#endif 7*67e74705SXin Li 8*67e74705SXin Livoid *memset(void *, int, __SIZE_TYPE__); 9*67e74705SXin Livoid *memmove(void *s1, const void *s2, __SIZE_TYPE__ n); 10*67e74705SXin Livoid *memcpy(void *s1, const void *s2, __SIZE_TYPE__ n); 11*67e74705SXin Li 12*67e74705SXin Li#ifdef __cplusplus 13*67e74705SXin Li} 14*67e74705SXin Li#endif 15*67e74705SXin Li 16*67e74705SXin Livoid test(id __strong *sip, id __weak *wip, id __autoreleasing *aip, 17*67e74705SXin Li id __unsafe_unretained *uip, void *ptr) { 18*67e74705SXin Li // All okay. 19*67e74705SXin Li memset(sip, 0, 17); 20*67e74705SXin Li memset(wip, 0, 17); 21*67e74705SXin Li memset(aip, 0, 17); 22*67e74705SXin Li memset(uip, 0, 17); 23*67e74705SXin Li 24*67e74705SXin Li memcpy(sip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \ 25*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 26*67e74705SXin Li memcpy(wip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \ 27*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 28*67e74705SXin Li memcpy(aip, ptr, 17); // expected-warning{{destination for this 'memcpy' call is a pointer to ownership-qualified type}} \ 29*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 30*67e74705SXin Li memcpy(uip, ptr, 17); 31*67e74705SXin Li 32*67e74705SXin Li memcpy(ptr, sip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \ 33*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 34*67e74705SXin Li memcpy(ptr, wip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \ 35*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 36*67e74705SXin Li memcpy(ptr, aip, 17); // expected-warning{{source of this 'memcpy' call is a pointer to ownership-qualified type}} \ 37*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 38*67e74705SXin Li memcpy(ptr, uip, 17); 39*67e74705SXin Li 40*67e74705SXin Li memmove(sip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \ 41*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 42*67e74705SXin Li memmove(wip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \ 43*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 44*67e74705SXin Li memmove(aip, ptr, 17); // expected-warning{{destination for this 'memmove' call is a pointer to ownership-qualified type}} \ 45*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 46*67e74705SXin Li memmove(uip, ptr, 17); 47*67e74705SXin Li 48*67e74705SXin Li memmove(ptr, sip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \ 49*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 50*67e74705SXin Li memmove(ptr, wip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \ 51*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 52*67e74705SXin Li memmove(ptr, aip, 17); // expected-warning{{source of this 'memmove' call is a pointer to ownership-qualified type}} \ 53*67e74705SXin Li // expected-note{{explicitly cast the pointer to silence this warning}} 54*67e74705SXin Li memmove(ptr, uip, 17); 55*67e74705SXin Li} 56*67e74705SXin Li 57*67e74705SXin Livoid rdar9772982(int i, ...) { 58*67e74705SXin Li __builtin_va_list ap; 59*67e74705SXin Li 60*67e74705SXin Li __builtin_va_start(ap, i); 61*67e74705SXin Li __builtin_va_arg(ap, __strong id); // expected-error{{second argument to 'va_arg' is of ARC ownership-qualified type '__strong id'}} 62*67e74705SXin Li __builtin_va_end(ap); 63*67e74705SXin Li} 64