1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambucstatic id __attribute((objc_gc(weak))) a; 3*f4a2713aSLionel Sambucstatic id __attribute((objc_gc(strong))) b; 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambucstatic id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires a string}} 6*f4a2713aSLionel Sambucstatic id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires a string}} 7*f4a2713aSLionel Sambucstatic id __attribute((objc_gc(foo, 456))) e; // expected-error{{'objc_gc' attribute takes one argument}} 8*f4a2713aSLionel Sambucstatic id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}} 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambucstatic int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}} 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambucstatic __weak int h; // expected-warning {{'__weak' only applies to pointer types; type here is 'int'}} 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc// TODO: it would be great if this reported as __weak 15*f4a2713aSLionel Sambuc#define WEAK __weak 16*f4a2713aSLionel Sambucstatic WEAK int h; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}} 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc/* expected-warning {{'__weak' only applies to pointer types; type here is 'int'}}*/ static __we\ 19*f4a2713aSLionel Sambucak int i; 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc// rdar://problem/9126213 22*f4a2713aSLionel Sambucvoid test2(id __attribute((objc_gc(strong))) *strong, 23*f4a2713aSLionel Sambuc id __attribute((objc_gc(weak))) *weak) { 24*f4a2713aSLionel Sambuc void *opaque; 25*f4a2713aSLionel Sambuc opaque = strong; 26*f4a2713aSLionel Sambuc strong = opaque; 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc opaque = weak; 29*f4a2713aSLionel Sambuc weak = opaque; 30*f4a2713aSLionel Sambuc} 31