Files
swift-mirror/test/IRGen/sensitive.sil
Daniel Rodríguez Troitiño ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00

50 lines
1.6 KiB
Plaintext

// RUN: %target-swift-frontend -enable-experimental-feature Sensitive -emit-ir %s | %FileCheck %s
// RUN: %target-swift-frontend -target %module-target-future -enable-experimental-feature Sensitive -emit-ir %s | %FileCheck %s
// REQUIRES: swift_feature_Sensitive
sil_stage canonical
import Builtin
import Swift
@sensitive struct SensitiveStruct {
@_hasStorage @_hasInitialValue var a: Int64
@_hasStorage @_hasInitialValue var b: Int64
@_hasStorage @_hasInitialValue var c: Int64
}
// CHECK-LABEL: define{{.*}}void @testDestroy
// CHECK: call {{(i[0-9]+ @memset_s|void @swift_clearSensitive)\(ptr %0, i[0-9]+ 24}}
// CHECK: ret void
sil @testDestroy : $@convention(thin) (@in SensitiveStruct) -> () {
bb0(%0 : $*SensitiveStruct):
destroy_addr %0 : $*SensitiveStruct
%r = tuple ()
return %r : $()
}
// CHECK-LABEL: define{{.*}}void @testCopyAddrTake
// CHECK: call void @llvm.memcpy
// CHECK-NEXT: call {{(i[0-9]+ @memset_s|void @swift_clearSensitive)\(ptr %1, i[0-9]+ 24}}
// CHECK: ret void
sil @testCopyAddrTake : $@convention(thin) (@in SensitiveStruct) -> @out SensitiveStruct {
bb0(%0 : $*SensitiveStruct, %1 : $*SensitiveStruct):
copy_addr [take] %1 to [init] %0 : $*SensitiveStruct
%r = tuple ()
return %r : $()
}
// CHECK-LABEL: define{{.*}}void @testCopyAddrCopy
// CHECK-NOT: memset_s
// CHECK-NOT: swift_clearSensitive
// CHECK: ret void
sil @testCopyAddrCopy : $@convention(thin) (@in_guaranteed SensitiveStruct) -> @out SensitiveStruct {
bb0(%0 : $*SensitiveStruct, %1 : $*SensitiveStruct):
copy_addr %1 to [init] %0 : $*SensitiveStruct
%r = tuple ()
return %r : $()
}