xref: /llvm-project/clang/test/CodeGenObjC/objc-arc-container-subscripting.m (revision 2eb84c3ae2bf6c918c20cbe1c315e2f4683056f4)
1// RUN: %clang_cc1 -fobjc-arc -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
2
3@interface NSMutableArray
4- (id)objectAtIndexedSubscript:(int)index;
5- (void)setObject:(id)object atIndexedSubscript:(int)index;
6@end
7
8id func(void) {
9  NSMutableArray *array;
10  array[3] = 0;
11  return array[3];
12}
13
14// CHECK: [[call:%.*]] = call ptr @objc_msgSend
15// CHECK: [[SIX:%.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr [[call]]) [[NUW:#[0-9]+]]
16// CHECK: call void @llvm.objc.storeStrong(ptr {{%.*}}, ptr null)
17// CHECK: [[EIGHT:%.*]] = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr [[SIX]]) [[NUW]]
18// CHECK: ret ptr [[EIGHT]]
19
20// CHECK: attributes [[NUW]] = { nounwind }
21