Skip to content

Commit d234cb3

Browse files
authored
Merge pull request swiftlang#61170 from tshortli/back-deploy-attr-weak-linkage-5.7
[5.7] SILGen: Function availability for linkage should use @_backDeploy OS version if present
2 parents 3a943ba + ea96f34 commit d234cb3

16 files changed

+87
-35
lines changed

include/swift/AST/Attr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,9 @@ class BackDeployAttr: public DeclAttribute {
21972197
/// The earliest platform version that may use the back deployed implementation.
21982198
const llvm::VersionTuple Version;
21992199

2200+
/// Returns true if this attribute is active given the current platform.
2201+
bool isActivePlatform(const ASTContext &ctx) const;
2202+
22002203
static bool classof(const DeclAttribute *DA) {
22012204
return DA->getKind() == DAK_BackDeploy;
22022205
}

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
836836
/// Returns the OS version in which the decl became ABI as specified by the
837837
/// @_backDeploy attribute.
838838
Optional<llvm::VersionTuple>
839-
getBackDeployBeforeOSVersion(PlatformKind Kind) const;
839+
getBackDeployBeforeOSVersion(ASTContext &Ctx) const;
840840

841841
/// Returns the starting location of the entire declaration.
842842
SourceLoc getStartLoc() const { return getSourceRange().Start; }

include/swift/SIL/SILDeclRef.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
#ifndef SWIFT_SIL_SILDeclRef_H
2020
#define SWIFT_SIL_SILDeclRef_H
2121

22+
#include "swift/AST/Availability.h"
2223
#include "swift/AST/ClangNode.h"
2324
#include "swift/AST/GenericSignature.h"
2425
#include "swift/AST/TypeAlignments.h"
25-
#include "llvm/ADT/Hashing.h"
2626
#include "llvm/ADT/DenseMap.h"
27+
#include "llvm/ADT/Hashing.h"
2728
#include "llvm/ADT/PointerUnion.h"
2829
#include "llvm/Support/PrettyStackTrace.h"
2930

@@ -530,6 +531,9 @@ struct SILDeclRef {
530531
static AbstractFunctionDecl *getOverriddenWitnessTableEntry(
531532
AbstractFunctionDecl *func);
532533

534+
/// Returns the availability of the decl for computing linkage.
535+
Optional<AvailabilityContext> getAvailabilityForLinkage() const;
536+
533537
/// True if the referenced entity is some kind of thunk.
534538
bool isThunk() const;
535539

lib/AST/Attr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,10 @@ bool AvailableAttr::isActivePlatform(const ASTContext &ctx) const {
16831683
return isPlatformActive(Platform, ctx.LangOpts);
16841684
}
16851685

1686+
bool BackDeployAttr::isActivePlatform(const ASTContext &ctx) const {
1687+
return isPlatformActive(Platform, ctx.LangOpts);
1688+
}
1689+
16861690
AvailableAttr *AvailableAttr::clone(ASTContext &C, bool implicit) const {
16871691
return new (C) AvailableAttr(implicit ? SourceLoc() : AtLoc,
16881692
implicit ? SourceRange() : getRange(),

lib/AST/Decl.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,19 @@ Decl::getIntroducedOSVersion(PlatformKind Kind) const {
378378
}
379379

380380
Optional<llvm::VersionTuple>
381-
Decl::getBackDeployBeforeOSVersion(PlatformKind Kind) const {
381+
Decl::getBackDeployBeforeOSVersion(ASTContext &Ctx) const {
382382
for (auto *attr : getAttrs()) {
383383
if (auto *backDeployAttr = dyn_cast<BackDeployAttr>(attr)) {
384-
if (backDeployAttr->Platform == Kind && backDeployAttr->Version) {
384+
if (backDeployAttr->isActivePlatform(Ctx) && backDeployAttr->Version) {
385385
return backDeployAttr->Version;
386386
}
387387
}
388388
}
389389

390390
// Accessors may inherit `@_backDeploy`.
391391
if (getKind() == DeclKind::Accessor) {
392-
return cast<AccessorDecl>(this)->getStorage()->getBackDeployBeforeOSVersion(Kind);
392+
return cast<AccessorDecl>(this)->getStorage()->getBackDeployBeforeOSVersion(
393+
Ctx);
393394
}
394395

395396
return None;
@@ -927,14 +928,20 @@ bool Decl::isStdlibDecl() const {
927928
}
928929

929930
AvailabilityContext Decl::getAvailabilityForLinkage() const {
931+
ASTContext &ctx = getASTContext();
932+
933+
// When computing availability for linkage, use the "before" version from
934+
// the @_backDeploy attribute, if present.
935+
if (auto backDeployVersion = getBackDeployBeforeOSVersion(ctx))
936+
return AvailabilityContext{VersionRange::allGTE(*backDeployVersion)};
937+
930938
auto containingContext =
931939
AvailabilityInference::annotatedAvailableRange(this, getASTContext());
932940
if (containingContext.hasValue()) {
933-
// If this entity comes from the concurrency module, adjust it's
941+
// If this entity comes from the concurrency module, adjust its
934942
// availability for linkage purposes up to Swift 5.5, so that we use
935943
// weak references any time we reference those symbols when back-deploying
936944
// concurrency.
937-
ASTContext &ctx = getASTContext();
938945
if (getModuleContext()->getName() == ctx.Id_Concurrency) {
939946
containingContext->intersectWith(ctx.getConcurrencyAvailability());
940947
}

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ ASTContext &SILDeclRef::getASTContext() const {
207207
llvm_unreachable("Unhandled case in switch");
208208
}
209209

210+
Optional<AvailabilityContext> SILDeclRef::getAvailabilityForLinkage() const {
211+
// Back deployment thunks and fallbacks don't have availability since they
212+
// are non-ABI.
213+
// FIXME: Generalize this check to all kinds of non-ABI functions.
214+
if (backDeploymentKind != SILDeclRef::BackDeploymentKind::None)
215+
return None;
216+
217+
return getDecl()->getAvailabilityForLinkage();
218+
}
219+
210220
bool SILDeclRef::isThunk() const {
211221
return isForeignToNativeThunk() || isNativeToForeignThunk() ||
212222
isDistributedThunk() || isBackDeploymentThunk();

lib/SIL/IR/SILFunctionBuilder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ SILFunction *SILFunctionBuilder::getOrCreateFunction(
311311
if (constant.isForeign && decl->hasClangNode())
312312
F->setClangNodeOwner(decl);
313313

314-
F->setAvailabilityForLinkage(decl->getAvailabilityForLinkage());
314+
if (auto availability = constant.getAvailabilityForLinkage())
315+
F->setAvailabilityForLinkage(*availability);
316+
315317
F->setAlwaysWeakImported(decl->isAlwaysWeakImported());
316318

317319
if (auto *accessor = dyn_cast<AccessorDecl>(decl)) {

lib/SILGen/SILGenBackDeploy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ static void emitBackDeployIfAvailableCondition(SILGenFunction &SGF,
5252
SILLocation loc,
5353
SILBasicBlock *availableBB,
5454
SILBasicBlock *unavailableBB) {
55-
PlatformKind platform = targetPlatform(SGF.SGM.getASTContext().LangOpts);
56-
auto version = AFD->getBackDeployBeforeOSVersion(platform);
55+
auto version = AFD->getBackDeployBeforeOSVersion(SGF.SGM.getASTContext());
5756
VersionRange OSVersion = VersionRange::empty();
5857
if (version.hasValue()) {
5958
OSVersion = VersionRange::allGTE(*version);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/Library.swiftmodule -parse-as-library %t/Library.swift -enable-library-evolution
4+
5+
// RUN: %target-swift-frontend -primary-file %t/Client.swift -I %t -emit-ir -target %target-cpu-apple-macosx10.50 | %FileCheck %t/Client.swift --check-prefix=CHECK-OLD
6+
// RUN: %target-swift-frontend -primary-file %t/Client.swift -I %t -emit-ir -target %target-cpu-apple-macosx10.60 | %FileCheck %t/Client.swift --check-prefix=CHECK-NEW
7+
8+
// REQUIRES: OS=macosx
9+
10+
//--- Library.swift
11+
12+
@available(macOS 10.50, *)
13+
@_backDeploy(before: macOS 10.60)
14+
public func backDeployedFunc() {}
15+
16+
//--- Client.swift
17+
18+
import Library
19+
20+
// CHECK-OLD: declare extern_weak {{.*}} void @"$s7Library16backDeployedFuncyyF"()
21+
// CHECK-NEW: declare {{.*}} void @"$s7Library16backDeployedFuncyyF"()
22+
backDeployedFunc()

test/SILGen/back_deploy_attribute_accessor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
@available(macOS 10.50, *)
99
public struct TopLevelStruct {
1010
// -- Fallback definition for TopLevelStruct.property.getter
11-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvgTwB : $@convention(method) (TopLevelStruct) -> TopLevelStruct
11+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvgTwB : $@convention(method) (TopLevelStruct) -> TopLevelStruct
1212
// CHECK: bb0([[SELF:%.*]] : $TopLevelStruct):
1313
// CHECK: return [[SELF]] : $TopLevelStruct
1414

1515
// -- Back deployment thunk for TopLevelStruct.property.getter
16-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvgTwb : $@convention(method) (TopLevelStruct) -> TopLevelStruct
16+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvgTwb : $@convention(method) (TopLevelStruct) -> TopLevelStruct
1717
// CHECK: bb0([[BB0_ARG:%.*]] : $TopLevelStruct):
1818
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
1919
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -36,7 +36,7 @@ public struct TopLevelStruct {
3636
// CHECK: return [[RETURN_BB_ARG]] : $TopLevelStruct
3737

3838
// -- Original definition of TopLevelStruct.property.getter
39-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvg : $@convention(method) (TopLevelStruct) -> TopLevelStruct
39+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvg : $@convention(method) (TopLevelStruct) -> TopLevelStruct
4040
@available(macOS 10.51, *)
4141
@_backDeploy(before: macOS 10.52)
4242
public var property: TopLevelStruct { self }

test/SILGen/back_deploy_attribute_accessor_coroutine.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@available(macOS 10.50, *)
99
public struct TopLevelStruct {
1010
// -- Fallback definition for TopLevelStruct.property.read
11-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvrTwB : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
11+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvrTwB : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
1212
// CHECK: bb0([[BB0_ARG:%.*]] : $TopLevelStruct):
1313
// CHECK: yield [[BB0_ARG]] : $TopLevelStruct, resume [[RESUME_BB:bb[0-9]+]], unwind [[UNWIND_BB:bb[0-9]+]]
1414
//
@@ -20,7 +20,7 @@ public struct TopLevelStruct {
2020
// CHECK: unwind
2121

2222
// -- Back deployment thunk for TopLevelStruct.property.read
23-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvrTwb : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
23+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvrTwb : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
2424
// CHECK: bb0([[BB0_ARG:%.*]] : $TopLevelStruct):
2525
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
2626
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -63,7 +63,7 @@ public struct TopLevelStruct {
6363
// CHECK: unwind
6464

6565
// -- Original definition of TopLevelStruct.property.read
66-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvr : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
66+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvr : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
6767
@available(macOS 10.51, *)
6868
@_backDeploy(before: macOS 10.52)
6969
public var property: TopLevelStruct {

test/SILGen/back_deploy_attribute_func.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// REQUIRES: OS=macosx
77

88
// -- Fallback definition of trivialFunc()
9-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy11trivialFuncyyFTwB : $@convention(thin) () -> ()
9+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy11trivialFuncyyFTwB : $@convention(thin) () -> ()
1010
// CHECK: bb0:
1111
// CHECK: [[RESULT:%.*]] = tuple ()
1212
// CHECK: return [[RESULT]] : $()
1313

1414
// -- Back deployment thunk for trivialFunc()
15-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy11trivialFuncyyFTwb : $@convention(thin) () -> ()
15+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy11trivialFuncyyFTwb : $@convention(thin) () -> ()
1616
// CHECK: bb0:
1717
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
1818
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -36,19 +36,19 @@
3636
// CHECK: return [[RESULT]] : $()
3737

3838
// -- Original definition of trivialFunc()
39-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy11trivialFuncyyF : $@convention(thin) () -> ()
39+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11trivialFuncyyF : $@convention(thin) () -> ()
4040
@available(macOS 10.51, *)
4141
@_backDeploy(before: macOS 10.52)
4242
public func trivialFunc() {}
4343

4444
// -- Fallback definition of isNumber(_:)
45-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy8isNumberySbSiFTwB : $@convention(thin) (Int) -> Bool
45+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy8isNumberySbSiFTwB : $@convention(thin) (Int) -> Bool
4646
// CHECK: bb0([[ARG_X:%.*]] : $Int):
4747
// ...
4848
// CHECK: return {{%.*}} : $Bool
4949

5050
// -- Back deployment thunk for isNumber(_:)
51-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy8isNumberySbSiFTwb : $@convention(thin) (Int) -> Bool
51+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy8isNumberySbSiFTwb : $@convention(thin) (Int) -> Bool
5252
// CHECK: bb0([[ARG_X:%.*]] : $Int):
5353
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
5454
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -71,7 +71,7 @@ public func trivialFunc() {}
7171
// CHECK: return [[RETURN_BB_ARG]] : $Bool
7272

7373
// -- Original definition of isNumber(_:)
74-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy8isNumberySbSiF : $@convention(thin) (Int) -> Bool
74+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy8isNumberySbSiF : $@convention(thin) (Int) -> Bool
7575
@available(macOS 10.51, *)
7676
@_backDeploy(before: macOS 10.52)
7777
public func isNumber(_ x: Int) -> Bool {

test/SILGen/back_deploy_attribute_generic_func.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
// REQUIRES: OS=macosx
77

88
// -- Fallback definition of genericFunc()
9-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy11genericFuncyxxlFTwB : $@convention(thin) <T> (@in_guaranteed T) -> @out T
9+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy11genericFuncyxxlFTwB : $@convention(thin) <T> (@in_guaranteed T) -> @out T
1010
// CHECK: bb0([[OUT_ARG:%.*]] : $*T, [[IN_ARG:%.*]] : $*T):
1111
// CHECK: copy_addr [[IN_ARG]] to [initialization] [[OUT_ARG]] : $*T
1212
// CHECK: [[RESULT:%.*]] = tuple ()
1313
// CHECK: return [[RESULT]] : $()
1414

1515
// -- Back deployment thunk for genericFunc()
16-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy11genericFuncyxxlFTwb : $@convention(thin) <T> (@in_guaranteed T) -> @out T
16+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy11genericFuncyxxlFTwb : $@convention(thin) <T> (@in_guaranteed T) -> @out T
1717
// CHECK: bb0([[OUT_ARG:%.*]] : $*T, [[IN_ARG:%.*]] : $*T):
1818
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
1919
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -37,7 +37,7 @@
3737
// CHECK: return [[RESULT]] : $()
3838

3939
// -- Original definition of genericFunc()
40-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy11genericFuncyxxlF : $@convention(thin) <T> (@in_guaranteed T) -> @out T
40+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11genericFuncyxxlF : $@convention(thin) <T> (@in_guaranteed T) -> @out T
4141
@available(macOS 10.51, *)
4242
@_backDeploy(before: macOS 10.52)
4343
public func genericFunc<T>(_ t: T) -> T {

test/SILGen/back_deploy_attribute_struct_method.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
@available(macOS 10.50, *)
99
public struct TopLevelStruct {
1010
// -- Fallback definition for TopLevelStruct.trivialMethod()
11-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwB : $@convention(method) (TopLevelStruct) -> ()
11+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwB : $@convention(method) (TopLevelStruct) -> ()
1212
// CHECK: bb0({{%.*}} : $TopLevelStruct):
1313
// CHECK: [[RESULT:%.*]] = tuple ()
1414
// CHECK: return [[RESULT]] : $()
1515

1616
// -- Back deployment thunk for TopLevelStruct.trivialMethod()
17-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwb : $@convention(method) (TopLevelStruct) -> ()
17+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwb : $@convention(method) (TopLevelStruct) -> ()
1818
// CHECK: bb0([[BB0_ARG:%.*]] : $TopLevelStruct):
1919
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
2020
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -38,7 +38,7 @@ public struct TopLevelStruct {
3838
// CHECK: return [[RESULT]] : $()
3939

4040
// -- Original definition of TopLevelStruct.trivialMethod()
41-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyF : $@convention(method) (TopLevelStruct) -> ()
41+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyF : $@convention(method) (TopLevelStruct) -> ()
4242
@available(macOS 10.51, *)
4343
@_backDeploy(before: macOS 10.52)
4444
public func trivialMethod() {}

test/SILGen/back_deploy_attribute_throwing_func.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// REQUIRES: OS=macosx
77

88
// -- Fallback definition of throwingFunc()
9-
// CHECK-LABEL: sil non_abi [serialized] [available 10.51] [ossa] @$s11back_deploy12throwingFuncyyKFTwB : $@convention(thin) () -> @error Error
9+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy12throwingFuncyyKFTwB : $@convention(thin) () -> @error Error
1010
// CHECK: bb0:
1111
// CHECK: [[RESULT:%.*]] = tuple ()
1212
// CHECK: return [[RESULT]] : $()
1313

1414
// -- Back deployment thunk for throwingFunc()
15-
// CHECK-LABEL: sil non_abi [serialized] [thunk] [available 10.51] [ossa] @$s11back_deploy12throwingFuncyyKFTwb : $@convention(thin) () -> @error Error
15+
// CHECK-LABEL: sil non_abi [serialized] [thunk] [ossa] @$s11back_deploy12throwingFuncyyKFTwb : $@convention(thin) () -> @error Error
1616
// CHECK: bb0:
1717
// CHECK: [[MAJOR:%.*]] = integer_literal $Builtin.Word, 10
1818
// CHECK: [[MINOR:%.*]] = integer_literal $Builtin.Word, 52
@@ -49,7 +49,7 @@
4949
// CHECK: throw [[RETHROW_BB_ARG]] : $Error
5050

5151
// -- Original definition of throwingFunc()
52-
// CHECK-LABEL: sil [available 10.51] [ossa] @$s11back_deploy12throwingFuncyyKF : $@convention(thin) () -> @error Error
52+
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy12throwingFuncyyKF : $@convention(thin) () -> @error Error
5353
@available(macOS 10.51, *)
5454
@_backDeploy(before: macOS 10.52)
5555
public func throwingFunc() throws {}

test/attr/attr_backDeploy_evolution.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
// ---- (3) Run executable
6464
// RUN: %target-codesign %t/test_ABI
65-
// RUN: %target-run %t/test_ABI %t/SDK_ABI/Frameworks/BackDeployHelper.framework/BackDeployHelper | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-ABI %s
65+
// RUN: %target-run %t/test_ABI | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-ABI %s
6666

6767
// ---- (4) Build famework with BackDeploy 2.0 in the future
6868
// RUN: mkdir -p %t/SDK_BD/Frameworks/BackDeployHelper.framework/Modules/BackDeployHelper.swiftmodule
@@ -89,9 +89,10 @@
8989

9090
// ---- (6) Run executable
9191
// RUN: %target-codesign %t/test_BD
92-
// RUN: %target-run %t/test_BD %t/SDK_BD/Frameworks/BackDeployHelper.framework/BackDeployHelper | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-BD %s
92+
// RUN: %target-run %t/test_BD | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-BD %s
9393

94-
// ---- (7) Re-build famework with the back deployed APIs stripped
94+
// ---- (7) Re-build framework with the back deployed APIs stripped
95+
// RUN: %empty-directory(%t/SDK_BD)
9596
// RUN: mkdir -p %t/SDK_BD/Frameworks/BackDeployHelper.framework/Modules/BackDeployHelper.swiftmodule
9697
// RUN: %target-build-swift-dylib(%t/SDK_BD/Frameworks/BackDeployHelper.framework/BackDeployHelper) \
9798
// RUN: -emit-module-path %t/SDK_BD/Frameworks/BackDeployHelper.framework/Modules/BackDeployHelper.swiftmodule/%module-target-triple.swiftmodule \
@@ -106,7 +107,7 @@
106107

107108
// ---- (8) Re-run executable
108109
// RUN: %target-codesign %t/test_BD
109-
// RUN: %target-run %t/test_BD %t/SDK_BD/Frameworks/BackDeployHelper.framework/BackDeployHelper | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-BD %s
110+
// RUN: %target-run %t/test_BD | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-BD %s
110111

111112
import BackDeployHelper
112113

0 commit comments

Comments
 (0)