Files
swift-mirror/test/SILOptimizer/moveonly_addresschecker_tsan.swift
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

41 lines
1.6 KiB
Swift

// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
// RUN: %target-swift-emit-sil -sanitize=thread -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
// REQUIRES: OS=macosx
// REQUIRES: swift_feature_MoveOnlyClasses
// REQUIRES: swift_feature_NoImplicitCopy
// This file contains tests that used to crash due to verifier errors. It must
// be separate from moveonly_addresschecker_diagnostics since when we fail on
// the diagnostics in that file, we do not actually run the verifier.
struct TestTrivialReturnValue : ~Copyable {
var i: Int = 5
// We used to error on return buffer.
consuming func drain() -> Int {
let buffer = (consume self).i
self = .init(i: 5)
return buffer
}
}
//////////////////////
// MARK: Misc Tests //
//////////////////////
func testAssertLikeUseDifferentBits() {
struct S : ~Copyable {
var s: [Int] = []
var currentPosition = 5
// CHECK-LABEL: sil private @$s28moveonly_addresschecker_tsan30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF : $@convention(method) (Int, @inout S) -> () {
// CHECK-NOT: destroy_addr
// CHECK: } // end sil function '$s28moveonly_addresschecker_tsan30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF'
mutating func resume(at index: Int) {
assert(index >= currentPosition)
currentPosition = index
}
}
}