Files
swift-mirror/test/IRGen/keypath_accessor.sil
Anthony Latsis b5aec4cc34 [test] Remove pre-rebranch nocapture matches
These were added in https://github.com/swiftlang/swift/pull/81375 (and
several other follow-up PRs because we missed a few places) and
are no longer needed.
2025-10-24 02:07:22 +01:00

60 lines
2.3 KiB
Plaintext

// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize
sil_stage canonical
import Swift
public struct Blah {
public subscript<T>(x: T) -> Int { get set }
public subscript<T>(x: T, y: T) -> Int { get set }
public subscript<T, U>(x: T, y: U) -> Int { get set }
}
// CHECK: define{{.*}} swiftcc void @"$simple_getter"(
// CHECK-SAME: ptr{{.*}} sret(%TSi) captures(none) %0,
// CHECK-SAME: ptr{{.*}} %1,
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$simple_getter : $@convention(keypath_accessor_getter) (@in_guaranteed Blah) -> @out Int {
bb0(%0 : $*Int, %1 : $*Blah):
unreachable
}
// CHECK: define{{.*}} swiftcc void @"$generic_indices_getter"(
// CHECK-SAME: ptr{{.*}} {{.*}} %0,
// CHECK-SAME: ptr{{.*}} %1,
// %2 = the key path component buffer pointer and %3 is the size
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$generic_indices_getter : $@convention(keypath_accessor_getter) <T where T : Hashable> (@in_guaranteed Blah, @in_guaranteed (_: T)) -> @out Int {
bb0(%0 : $*Int, %1 : $*Blah, %2 : $*(_: T)):
unreachable
}
// CHECK: define{{.*}} swiftcc void @"$generic_indices_setter"(
// CHECK-SAME: ptr{{.*}} %0,
// CHECK-SAME: ptr{{.*}} %1,
// %2 = the key path component buffer pointer and %3 is the size
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$generic_indices_setter : $@convention(keypath_accessor_setter) <T where T : Hashable> (@in_guaranteed Int, @inout Blah, @in_guaranteed (_: T)) -> () {
bb0(%0 : $*Int, %1 : $*Blah, %2 : $*(_: T)):
unreachable
}
// CHECK: define{{.*}} swiftcc [[INT]] @"$generic_indices_hash"(
// %0 = the key path component buffer pointer and %1 is the size
// CHECK-SAME: ptr{{.*}} %0, [[INT]] %1)
sil @$generic_indices_hash : $@convention(keypath_accessor_hash) <T where T : Hashable> (@in_guaranteed (_: T)) -> Int {
bb0(%0 : $*(_: T)):
unreachable
}
// CHECK: define{{.*}} swiftcc i1 @"$generic_indices_equals"(
// %0 = LHS of key path component buffer pointer
// %1 = RHS of key path component buffer pointer
// %2 = the size of the key path component buffers
// CHECK-SAME: ptr{{.*}} %0, ptr{{.*}} %1, [[INT]] %2)
sil @$generic_indices_equals : $@convention(keypath_accessor_equals) <T where T : Hashable> (@in_guaranteed (_: T), @in_guaranteed (_: T)) -> Bool {
bb0(%0 : $*(_: T), %1 : $*(_: T)):
unreachable
}