llvm-project/clang/test/CodeGenObjC/objc-arc-container-subscripting.m
John Hui b791501e80
Revert "Reapply "[CGObjC] Allow clang.arc.attachedcall on -O0 (#164875)" (#177285)" (#177533)
This reverts commit 4b939beb79e3390046b760bef71b7d891ba9b4df.

This commit seems to be causing these test failures:

- ThreadSanitizer-x86_64-iossim.Darwin.norace-objcxx-run-time.mm
https://ci.swift.org/job/llvm.org/job/clang-san-iossim/14230/testReport/junit/ThreadSanitizer-x86_64-iossim/Darwin/norace_objcxx_run_time_mm/
- ThreadSanitizer-x86_64-iossim.Darwin.objc-synchronize-cycle-tagged.mm
https://ci.swift.org/job/llvm.org/job/clang-san-iossim/14230/testReport/junit/ThreadSanitizer-x86_64-iossim/Darwin/objc_synchronize_cycle_tagged_mm/
- ThreadSanitizer-x86_64-iossim.Darwin.objc-synchronize-tagged.mm
https://ci.swift.org/job/llvm.org/job/clang-san-iossim/14230/testReport/junit/ThreadSanitizer-x86_64-iossim/Darwin/objc_synchronize_tagged_mm/
- ThreadSanitizer-x86_64-iossim.Darwin.objc-synchronize.mm
https://ci.swift.org/job/llvm.org/job/clang-san-iossim/14230/testReport/junit/ThreadSanitizer-x86_64-iossim/Darwin/objc_synchronize_mm/


With the error message:

```
fatal error: error in backend: Cannot select: intrinsic %llvm.objc.clang.arc.noop.use
```
2026-01-23 11:56:31 +01:00

21 lines
700 B
Objective-C

// RUN: %clang_cc1 -fobjc-arc -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
@interface NSMutableArray
- (id)objectAtIndexedSubscript:(int)index;
- (void)setObject:(id)object atIndexedSubscript:(int)index;
@end
id func(void) {
NSMutableArray *array;
array[3] = 0;
return array[3];
}
// CHECK: [[call:%.*]] = call ptr @objc_msgSend
// CHECK: [[SIX:%.*]] = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr [[call]]) [[NUW:#[0-9]+]]
// CHECK: call void @llvm.objc.storeStrong(ptr {{%.*}}, ptr null)
// CHECK: [[EIGHT:%.*]] = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr [[SIX]]) [[NUW]]
// CHECK: ret ptr [[EIGHT]]
// CHECK: attributes [[NUW]] = { nounwind }