Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s |
| 2 | // RUN: grep objc_assign_ivar %t | count 3 |
| 3 | // RUN: grep objc_assign_strongCast %t | count 6 |
| 4 | |
| 5 | struct Slice { |
| 6 | void *__strong * items; |
| 7 | }; |
| 8 | |
| 9 | typedef struct Slice Slice; |
| 10 | |
| 11 | @interface ISlice { |
| 12 | @public |
| 13 | void *__strong * IvarItem; |
| 14 | } |
| 15 | @end |
| 16 | |
| 17 | typedef void (^observer_block_t)(id object); |
| 18 | @interface Observer { |
| 19 | @public |
| 20 | observer_block_t block; |
| 21 | } |
| 22 | @end |
| 23 | |
| 24 | |
| 25 | void 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 | |
| 34 | Slice *slice; |
| 35 | slice->items = 0; |
| 36 | // storing into a struct element of an array of strong pointer types. |
| 37 | slice->items[i] = 0; |
| 38 | |
| 39 | ISlice *islice; |
| 40 | islice->IvarItem = 0; |
| 41 | // Storing into an ivar of an array of strong pointer types. |
| 42 | islice->IvarItem[i] = (void*)0; |
| 43 | |
| 44 | Observer *observer; |
| 45 | observer->block = 0; |
| 46 | } |