mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Generic specialization already takes care of removing metatype arguments of generic functions. But sometimes non-generic functions have metatype arguments which must be removed. We need handle this case with a function signature optimization. This enables, for example, to use `OptionSet` in embedded swift. rdar://121206953
30 lines
771 B
Swift
30 lines
771 B
Swift
// RUN: %target-swift-frontend -target armv7-apple-none-macho -Xcc -D__MACH__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
|
|
// RUN: %target-swift-frontend -target arm64-apple-none-macho -Xcc -D__MACH__ -Xcc -D__arm64__ -Xcc -D__APPLE__ -emit-ir %s -enable-experimental-feature Embedded | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: CODEGENERATOR=ARM
|
|
|
|
protocol MyOptionSet: Equatable {
|
|
init(rawValue: Int)
|
|
init()
|
|
}
|
|
|
|
extension MyOptionSet {
|
|
var isEmpty: Bool {
|
|
return self == Self()
|
|
}
|
|
init() {
|
|
self.init(rawValue: 0)
|
|
}
|
|
}
|
|
|
|
struct ShippingOptions: MyOptionSet {
|
|
let rawValue: Int
|
|
}
|
|
|
|
var s = ShippingOptions(rawValue: 42)
|
|
print(s.isEmpty)
|
|
|
|
// CHECK: define {{.*}}i32 @main(i32 %0, ptr %1)
|