mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IRGen] Mangling of nonisolated(nonsending) function types was introduced in Swift 6.2
We can't use mangled named when back-deploying earlier.
This commit is contained in:
@@ -204,9 +204,10 @@ getRuntimeVersionThatSupportsDemanglingType(CanType type) {
|
||||
Swift_5_5,
|
||||
Swift_6_0,
|
||||
Swift_6_1,
|
||||
Swift_6_2,
|
||||
|
||||
// Short-circuit if we find this requirement.
|
||||
Latest = Swift_6_1
|
||||
Latest = Swift_6_2
|
||||
};
|
||||
|
||||
VersionRequirement latestRequirement = None;
|
||||
@@ -223,6 +224,11 @@ getRuntimeVersionThatSupportsDemanglingType(CanType type) {
|
||||
auto isolation = fn->getIsolation();
|
||||
auto sendingResult = fn->hasSendingResult();
|
||||
|
||||
// The mangling for nonisolated(nonsending) function types was introduced
|
||||
// in Swift 6.2.
|
||||
if (isolation.isNonIsolatedCaller())
|
||||
return addRequirement(Swift_6_2);
|
||||
|
||||
// The Swift 6.1 runtime fixes a bug preventing successful demangling
|
||||
// when @isolated(any) or global actor isolation is combined with a
|
||||
// sending result.
|
||||
@@ -290,6 +296,7 @@ getRuntimeVersionThatSupportsDemanglingType(CanType type) {
|
||||
});
|
||||
|
||||
switch (latestRequirement) {
|
||||
case Swift_6_2: return llvm::VersionTuple(6, 2);
|
||||
case Swift_6_1: return llvm::VersionTuple(6, 1);
|
||||
case Swift_6_0: return llvm::VersionTuple(6, 0);
|
||||
case Swift_5_5: return llvm::VersionTuple(5, 5);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// RUN: %target-swift-frontend -target %target-cpu-apple-macos12 -emit-ir -o - -primary-file %s | %FileCheck %s
|
||||
// REQUIRES: concurrency
|
||||
// REQUIRES: OS=macosx
|
||||
|
||||
func useGenericMetatype(_ type: Any.Type) { }
|
||||
|
||||
// CHECK-LABEL: define hidden swiftcc void @"$s52backward_deploy_nonisolated_nonsending_function_type29testNonisolatedNonsendingTypeyyF"()
|
||||
func testNonisolatedNonsendingType() {
|
||||
typealias Fn = nonisolated(nonsending) () async throws -> Int
|
||||
|
||||
// CHECK: call swiftcc %swift.metadata_response @"$sSiyYaKYCcMa"
|
||||
// CHECK: call swiftcc void @"$s52backward_deploy_nonisolated_nonsending_function_type18useGenericMetatypeyyypXpF"
|
||||
useGenericMetatype(Fn.self)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define linkonce_odr hidden swiftcc %swift.metadata_response @"$sSiyYaKYCcMa"
|
||||
// CHECK: call ptr @swift_getExtendedFunctionTypeMetadata(i{{32|64}} 2768240640, {{i32|i64}} 0, ptr null, ptr null, ptr @"$sSiN"
|
||||
Reference in New Issue
Block a user