blob: 7058302f98a8b6d4ee73cce9ea81319b67348191 [file] [log] [blame]
Daniel Dunbard71b6412009-11-17 10:04:38 +00001// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00002// RUN: grep objc_assign_ivar %t | count 3
3// RUN: grep objc_assign_strongCast %t | count 6
Fariborz Jahanianac423ba2009-09-08 19:45:47 +00004
5struct Slice {
6 void *__strong * items;
7};
8
9typedef struct Slice Slice;
10
11@interface ISlice {
12@public
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000013 void *__strong * IvarItem;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000014}
15@end
16
Fariborz Jahanian75212ee2009-09-10 23:38:45 +000017typedef void (^observer_block_t)(id object);
18@interface Observer {
19@public
20 observer_block_t block;
21}
22@end
23
24
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000025void foo (int i) {
26 // storing into an array of strong pointer types.
27 void *__strong* items;
28 items[i] = 0;
29
30 // storing indirectly into an array of strong pointer types.
31 void *__strong* *vitems;
32 *vitems[i] = 0;
33
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000034 Slice *slice;
35 slice->items = 0;
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000036 // storing into a struct element of an array of strong pointer types.
37 slice->items[i] = 0;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000038
39 ISlice *islice;
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000040 islice->IvarItem = 0;
41 // Storing into an ivar of an array of strong pointer types.
42 islice->IvarItem[i] = (void*)0;
Fariborz Jahanian75212ee2009-09-10 23:38:45 +000043
44 Observer *observer;
45 observer->block = 0;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000046}