blob: 6603e32465739aece32349a0bd4ea57a52c3f9ea [file] [log] [blame]
Fariborz Jahanianb17a1902009-09-08 19:45:47 +00001// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
Fariborz Jahanian8d6298b2009-09-10 23:38:45 +00002// RUN: grep objc_assign_strongCast %t | count 8 &&
Fariborz Jahanianb17a1902009-09-08 19:45:47 +00003// RUN: true
4
5struct Slice {
6 void *__strong * items;
7};
8
9typedef struct Slice Slice;
10
11@interface ISlice {
12@public
Fariborz Jahanian063c7722009-09-08 23:38:54 +000013 void *__strong * IvarItem;
Fariborz Jahanianb17a1902009-09-08 19:45:47 +000014}
15@end
16
Fariborz Jahanian8d6298b2009-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 Jahanian063c7722009-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 Jahanianb17a1902009-09-08 19:45:47 +000034 Slice *slice;
35 slice->items = 0;
Fariborz Jahanian063c7722009-09-08 23:38:54 +000036 // storing into a struct element of an array of strong pointer types.
37 slice->items[i] = 0;
Fariborz Jahanianb17a1902009-09-08 19:45:47 +000038
39 ISlice *islice;
Fariborz Jahanian063c7722009-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 Jahanian8d6298b2009-09-10 23:38:45 +000043
44 Observer *observer;
45 observer->block = 0;
Fariborz Jahanianb17a1902009-09-08 19:45:47 +000046}