Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenObjC / objc-container-subscripting.m
blob6ec8d9ca668af6b25994d943c84317a9fa41150c
1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o /dev/null
3 typedef unsigned int size_t;
4 @protocol P @end
6 @interface NSMutableArray
7 #if __has_feature(objc_subscripting)
8 - (id)objectAtIndexedSubscript:(size_t)index;
9 - (void)setObject:(id)object atIndexedSubscript:(size_t)index;
10 #endif
11 @end
13 #if __has_feature(objc_subscripting)
14 @interface XNSMutableArray
15 - (id)objectAtIndexedSubscript:(size_t)index;
16 - (void)setObject:(id)object atIndexedSubscript:(size_t)index;
17 #endif
18 @end
20 @interface NSMutableDictionary
21 - (id)objectForKeyedSubscript:(id)key;
22 - (void)setObject:(id)object forKeyedSubscript:(id)key;
23 @end
25 @class NSString;
27 int main(void) {
28   NSMutableArray<P> * array;
29   id oldObject = array[10];
31   array[10] = oldObject;
33   id unknown_array;
34   oldObject = unknown_array[1];
36   unknown_array[1] = oldObject;
38   NSMutableDictionary *dictionary;
39   NSString *key;
40   id newObject;
41   oldObject = dictionary[key];
42   dictionary[key] = newObject;  // replace oldObject with newObject