mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
For dynamic features defined from a header, we synthesize a pure Clang function to check whether the feature should be enabled at runtime. Swift modules don't have capability to deserialize this clang predicate function, leading to crasher as a result. This change fixes the crasher by hiding the synthesized function to be a module internal one. rdar://164410957
43 lines
1.1 KiB
Swift
43 lines
1.1 KiB
Swift
// REQUIRES: swift_feature_CustomAvailability
|
|
// RUN: %empty-directory(%t/mod)
|
|
// RUN: %target-swift-frontend -emit-module %s -o %t/mod/Foo.swiftmodule -parse-as-library -enable-library-evolution -module-name Foo -import-bridging-header %S/Inputs/AvailabilityDomains.h -enable-experimental-feature CustomAvailability -D FOO
|
|
// RUN: %target-swift-frontend -emit-module %s -o %t/mod/Bar.swiftmodule -parse-as-library -enable-library-evolution -module-name Bar -import-bridging-header %S/Inputs/AvailabilityDomains.h -enable-experimental-feature CustomAvailability -I %t/mod -D BAR
|
|
|
|
#if FOO
|
|
|
|
@available(DynamicDomain)
|
|
public struct X {
|
|
public init() { }
|
|
}
|
|
|
|
public struct Z {
|
|
public init() {
|
|
if #available(DynamicDomain) {
|
|
print("#available")
|
|
print(X())
|
|
} else {
|
|
print("#unavailable")
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|
|
#if BAR
|
|
|
|
import Foo
|
|
|
|
public struct Y {
|
|
init() {
|
|
if #available(DynamicDomain) {
|
|
print("#available")
|
|
print(X())
|
|
print(Z())
|
|
} else {
|
|
print("#unavailable")
|
|
print(Z())
|
|
}
|
|
}
|
|
|
|
}
|
|
#endif |