1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
2 // RUN: grep -F '@objc_assign_ivar' %t | count 14
8 __strong id cfElementArray[10];
12 @interface NSString @end
16 // assignments to any/all of these fields should generate objc_assign_ivar
18 __strong id dictArray[3];
22 NSString *stringArray[10];
23 struct_with_ids_t inner;
33 #define ASSIGNTEST(expr, global) expr = rhs
35 void testIvars(void) {
37 ASSIGNTEST(foo->ivar, IvarAssigns); // objc_assign_ivar
38 ASSIGNTEST(foo->dict, IvarAssigns); // objc_assign_ivar
39 ASSIGNTEST(foo->dictArray[0], IvarAssigns); // objc_assign_ivar
40 ASSIGNTEST(foo->array[0], IvarAssigns); // objc_assign_ivar
41 ASSIGNTEST(foo->nsobject, IvarAssigns); // objc_assign_ivar
42 ASSIGNTEST(foo->stringArray[0], IvarAssigns); // objc_assign_ivar
43 ASSIGNTEST(foo->inner.element, IvarAssigns); // objc_assign_ivar
44 ASSIGNTEST(foo->inner.elementArray[0], IvarAssigns); // objc_assign_ivar
45 ASSIGNTEST(foo->inner.cfElement, IvarAssigns); // objc_assign_ivar
46 ASSIGNTEST(foo->inner.cfElementArray[0], IvarAssigns); // objc_assign_ivar
48 ASSIGNTEST(foo->obj[5], IvarAssigns); // objc_assign_ivar
49 ASSIGNTEST(foo->obj[++counter], IvarAssigns); // objc_assign_ivar
50 foo->idx[++counter] = 15;
51 ASSIGNTEST(foo->obj[foo->idx[2]], IvarAssigns); // objc_assign_ivar