Files
swift-mirror/test/IRGen/keypath_accessor.sil
Anthony Latsis 55e5618eab [test] Match nocapture to succeed both on main and rebranch
Both the syntax and relative order of the LLVM `nocapture` parameter
attribute changed upstream in 29441e4f5fa5f5c7709f7cf180815ba97f611297.
To reduce conflicts with rebranch, adjust FileCheck patterns to expect
both syntaxes and orders anywhere the presence of the attribute is not
critical to the test. These changes are temporary and will be cleaned
up once rebranch is merged into main.
2025-05-08 23:52:43 +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
}