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

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() {
}
}