blob: cb72cc06e55cfeb003abd0db75e2fe3ab1f03ccc [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -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 Jahanian27b7aa02010-05-20 18:22:28 +00004// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fobjc-gc -emit-llvm -o %t %s
5// RUN: grep objc_assign_ivar %t | count 3
6// RUN: grep objc_assign_strongCast %t | count 6
Fariborz Jahanianac423ba2009-09-08 19:45:47 +00007
8struct Slice {
9 void *__strong * items;
10};
11
12typedef struct Slice Slice;
13
14@interface ISlice {
15@public
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000016 void *__strong * IvarItem;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000017}
18@end
19
Fariborz Jahanian75212ee2009-09-10 23:38:45 +000020typedef void (^observer_block_t)(id object);
21@interface Observer {
22@public
23 observer_block_t block;
24}
25@end
26
27
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000028void foo (int i) {
29 // storing into an array of strong pointer types.
30 void *__strong* items;
31 items[i] = 0;
32
33 // storing indirectly into an array of strong pointer types.
34 void *__strong* *vitems;
35 *vitems[i] = 0;
36
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000037 Slice *slice;
38 slice->items = 0;
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000039 // storing into a struct element of an array of strong pointer types.
40 slice->items[i] = 0;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000041
42 ISlice *islice;
Fariborz Jahanian7f4f86a2009-09-08 23:38:54 +000043 islice->IvarItem = 0;
44 // Storing into an ivar of an array of strong pointer types.
45 islice->IvarItem[i] = (void*)0;
Fariborz Jahanian75212ee2009-09-10 23:38:45 +000046
47 Observer *observer;
48 observer->block = 0;
Fariborz Jahanianac423ba2009-09-08 19:45:47 +000049}