mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
91 lines
2.5 KiB
Swift
91 lines
2.5 KiB
Swift
// RUN: %target-swift-frontend -O -emit-ir -primary-file %s | %FileCheck %s
|
|
|
|
public struct PublicStruct {
|
|
}
|
|
|
|
public enum PublicEnum {
|
|
}
|
|
|
|
struct RegStruct {
|
|
enum EnumInRegStruct {
|
|
case case1
|
|
case case2
|
|
}
|
|
|
|
private var optNode: Any?
|
|
private var ClassInRegStructs = [ClassInRegStruct]()
|
|
|
|
var isEmpty: Bool {
|
|
return optNode == nil && ClassInRegStructs.isEmpty
|
|
}
|
|
|
|
private func funcInRegStruct() -> RegStruct? {
|
|
var funcInRegStruct = RegStruct()
|
|
return funcInRegStruct
|
|
}
|
|
|
|
func func2InRegStruct(boolParam: Bool = false,
|
|
_ body: (inout Bool) -> Void) {
|
|
var finished = false
|
|
func2InRegStruct(body, boolParam: boolParam, &finished)
|
|
}
|
|
|
|
private func func2InRegStruct(_ body: (inout Bool) -> Void,
|
|
boolParam: Bool = false, _ finished: inout Bool) {
|
|
funcInRegStruct()?.func2InRegStruct(body, boolParam: boolParam, &finished)
|
|
}
|
|
|
|
private static func func2InRegStruct(_ ClassInRegStructs: [ClassInRegStruct],
|
|
_ body: (inout Bool) -> Void,
|
|
boolParam: Bool, _ finished: inout Bool) {
|
|
}
|
|
|
|
func funcInStructAndProtAndExt(_ EnumInRegStruct: EnumInRegStruct, space: PublicEnum,
|
|
_ body: () -> Void) {
|
|
guard !isEmpty else { return }
|
|
|
|
func2InRegStruct(boolParam: !EnumInRegStruct.isDownwards) { finished in
|
|
}
|
|
}
|
|
|
|
final private class ClassInRegStruct {
|
|
}
|
|
}
|
|
|
|
extension RegStruct.EnumInRegStruct {
|
|
fileprivate var isDownwards: Bool {
|
|
switch self {
|
|
case .case1:
|
|
return true
|
|
case .case2:
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
private protocol ApplyRegStruct {
|
|
mutating func applyTransform()
|
|
}
|
|
|
|
protocol RegStructable {
|
|
mutating func funcInStructAndProtAndExt(from space: PublicEnum, transform: RegStruct)
|
|
}
|
|
|
|
extension ApplyRegStruct {
|
|
mutating func funcInStructAndProtAndExt(
|
|
from space: PublicEnum, transform: RegStruct
|
|
) {
|
|
transform.funcInStructAndProtAndExt(.case2, space: space) {
|
|
// CHECK-LABEL: define hidden swiftcc void @"$sSa39devirt_witness_method_empty_conformanceAA12PublicStructVRszlE14applyTransformyyF"(ptr{{( nocapture)?}} {{.*}}swiftself{{( captures\(none\))?}} dereferenceable
|
|
// CHECK-NEXT: entry
|
|
// CHECK-NEXT: ret void
|
|
applyTransform()
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Array : ApplyRegStruct, RegStructable where Element == PublicStruct {
|
|
mutating func applyTransform() {
|
|
}
|
|
}
|