annotate clang/test/CodeGenObjC/objc-container-subscripting.m @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o /dev/null
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 typedef unsigned int size_t;
anatofuz
parents:
diff changeset
4 @protocol P @end
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 @interface NSMutableArray
anatofuz
parents:
diff changeset
7 #if __has_feature(objc_subscripting)
anatofuz
parents:
diff changeset
8 - (id)objectAtIndexedSubscript:(size_t)index;
anatofuz
parents:
diff changeset
9 - (void)setObject:(id)object atIndexedSubscript:(size_t)index;
anatofuz
parents:
diff changeset
10 #endif
anatofuz
parents:
diff changeset
11 @end
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 #if __has_feature(objc_subscripting)
anatofuz
parents:
diff changeset
14 @interface XNSMutableArray
anatofuz
parents:
diff changeset
15 - (id)objectAtIndexedSubscript:(size_t)index;
anatofuz
parents:
diff changeset
16 - (void)setObject:(id)object atIndexedSubscript:(size_t)index;
anatofuz
parents:
diff changeset
17 #endif
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 @interface NSMutableDictionary
anatofuz
parents:
diff changeset
21 - (id)objectForKeyedSubscript:(id)key;
anatofuz
parents:
diff changeset
22 - (void)setObject:(id)object forKeyedSubscript:(id)key;
anatofuz
parents:
diff changeset
23 @end
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 @class NSString;
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 int main() {
anatofuz
parents:
diff changeset
28 NSMutableArray<P> * array;
anatofuz
parents:
diff changeset
29 id oldObject = array[10];
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 array[10] = oldObject;
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 id unknown_array;
anatofuz
parents:
diff changeset
34 oldObject = unknown_array[1];
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 unknown_array[1] = oldObject;
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 NSMutableDictionary *dictionary;
anatofuz
parents:
diff changeset
39 NSString *key;
anatofuz
parents:
diff changeset
40 id newObject;
anatofuz
parents:
diff changeset
41 oldObject = dictionary[key];
anatofuz
parents:
diff changeset
42 dictionary[key] = newObject; // replace oldObject with newObject
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 }
anatofuz
parents:
diff changeset
45