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