annotate clang/test/CodeGenObjC/objc2-write-barrier-3.m @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
anatofuz
parents:
diff changeset
2 // RUN: grep objc_assign_ivar %t | count 3
anatofuz
parents:
diff changeset
3 // RUN: grep objc_assign_strongCast %t | count 6
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fblocks -fobjc-gc -emit-llvm -o %t %s
anatofuz
parents:
diff changeset
5 // RUN: grep objc_assign_ivar %t | count 3
anatofuz
parents:
diff changeset
6 // RUN: grep objc_assign_strongCast %t | count 6
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 struct Slice {
anatofuz
parents:
diff changeset
9 void *__strong * items;
anatofuz
parents:
diff changeset
10 };
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 typedef struct Slice Slice;
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 @interface ISlice {
anatofuz
parents:
diff changeset
15 @public
anatofuz
parents:
diff changeset
16 void *__strong * IvarItem;
anatofuz
parents:
diff changeset
17 }
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 typedef void (^observer_block_t)(id object);
anatofuz
parents:
diff changeset
21 @interface Observer {
anatofuz
parents:
diff changeset
22 @public
anatofuz
parents:
diff changeset
23 observer_block_t block;
anatofuz
parents:
diff changeset
24 }
anatofuz
parents:
diff changeset
25 @end
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 void foo (int i) {
anatofuz
parents:
diff changeset
29 // storing into an array of strong pointer types.
anatofuz
parents:
diff changeset
30 void *__strong* items;
anatofuz
parents:
diff changeset
31 items[i] = 0;
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 // storing indirectly into an array of strong pointer types.
anatofuz
parents:
diff changeset
34 void *__strong* *vitems;
anatofuz
parents:
diff changeset
35 *vitems[i] = 0;
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 Slice *slice;
anatofuz
parents:
diff changeset
38 slice->items = 0;
anatofuz
parents:
diff changeset
39 // storing into a struct element of an array of strong pointer types.
anatofuz
parents:
diff changeset
40 slice->items[i] = 0;
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 ISlice *islice;
anatofuz
parents:
diff changeset
43 islice->IvarItem = 0;
anatofuz
parents:
diff changeset
44 // Storing into an ivar of an array of strong pointer types.
anatofuz
parents:
diff changeset
45 islice->IvarItem[i] = (void*)0;
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 Observer *observer;
anatofuz
parents:
diff changeset
48 observer->block = 0;
anatofuz
parents:
diff changeset
49 }