Skip to content

Commit d006afb

Browse files
authored
Merge pull request #65775 from tshortli/print-backdeployed-attr-in-swiftinterfaces
AST: Print official spelling of `@backDeployed` attr in swiftinterfaces
2 parents 8b05873 + 4a84ddb commit d006afb

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

include/swift/AST/Attr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,8 +2214,9 @@ class UnavailableFromAsyncAttr : public DeclAttribute {
22142214
}
22152215
};
22162216

2217-
/// The @_backDeploy(...) attribute, used to make function declarations available
2218-
/// for back deployment to older OSes via emission into the client binary.
2217+
/// The `@backDeployed(...)` attribute, used to make function declarations
2218+
/// available for back deployment to older OSes via emission into the client
2219+
/// binary.
22192220
class BackDeployedAttr : public DeclAttribute {
22202221
public:
22212222
BackDeployedAttr(SourceLoc AtLoc, SourceRange Range, PlatformKind Platform,

lib/AST/Attr.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,7 @@ static void printShortFormBackDeployed(ArrayRef<const DeclAttribute *> Attrs,
548548
ASTPrinter &Printer,
549549
const PrintOptions &Options) {
550550
assert(!Attrs.empty());
551-
// TODO: Print `@backDeployed` in swiftinterfaces (rdar://104920183)
552-
Printer << "@_backDeploy(before: ";
551+
Printer << "@backDeployed(before: ";
553552
bool isFirst = true;
554553

555554
for (auto *DA : Attrs) {
@@ -1344,8 +1343,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
13441343
}
13451344

13461345
case DAK_BackDeployed: {
1347-
// TODO: Print `@backDeployed` in swiftinterfaces (rdar://104920183)
1348-
Printer.printAttrName("@_backDeploy");
1346+
Printer.printAttrName("@backDeployed");
13491347
Printer << "(before: ";
13501348
auto Attr = cast<BackDeployedAttr>(this);
13511349
Printer << platformString(Attr->Platform) << " " <<

test/ModuleInterface/back-deployed-attr.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,32 @@
88
// REQUIRES: OS=macosx
99

1010
public struct TopLevelStruct {
11-
// TODO: Print `@backDeployed` in swiftinterfaces (rdar://104920183)
12-
// CHECK: @_backDeploy(before: macOS 12.0)
11+
// CHECK: @backDeployed(before: macOS 12.0)
1312
// CHECK: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 41 }
1413
@backDeployed(before: macOS 12.0)
1514
public func backDeployedFunc_SinglePlatform() -> Int { return 41 }
1615

17-
// CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0)
16+
// CHECK: @backDeployed(before: macOS 12.0, iOS 15.0)
1817
// CHECK: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 42 }
1918
@backDeployed(before: macOS 12.0, iOS 15.0)
2019
public func backDeployedFunc_MultiPlatform() -> Int { return 42 }
2120

22-
// CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0)
21+
// CHECK: @backDeployed(before: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0)
2322
// CHECK: public func backDeployedFunc_MultiPlatformSeparate() -> Swift.Int { return 43 }
2423
@backDeployed(before: macOS 12.0)
2524
@backDeployed(before: iOS 15.0)
2625
@backDeployed(before: watchOS 8.0)
2726
@backDeployed(before: tvOS 15.0)
2827
public func backDeployedFunc_MultiPlatformSeparate() -> Int { return 43 }
2928

30-
// CHECK: @_backDeploy(before: macOS 12.0)
29+
// CHECK: @backDeployed(before: macOS 12.0)
3130
// CHECK: public var backDeployedComputedProperty: Swift.Int {
3231
// CHECK-NEXT: get { 44 }
3332
// CHECK-NEXT: }
3433
@backDeployed(before: macOS 12.0)
3534
public var backDeployedComputedProperty: Int { 44 }
3635

37-
// CHECK: @_backDeploy(before: macOS 12.0)
36+
// CHECK: @backDeployed(before: macOS 12.0)
3837
// CHECK: public var backDeployedPropertyWithAccessors: Swift.Int {
3938
// CHECK-NEXT: get { 45 }
4039
// CHECK-NEXT: }
@@ -43,7 +42,7 @@ public struct TopLevelStruct {
4342
get { 45 }
4443
}
4544

46-
// CHECK: @_backDeploy(before: macOS 12.0)
45+
// CHECK: @backDeployed(before: macOS 12.0)
4746
// CHECK: public subscript(index: Swift.Int) -> Swift.Int {
4847
// CHECK-NEXT: get { 46 }
4948
// CHECK-NEXT: }
@@ -53,13 +52,13 @@ public struct TopLevelStruct {
5352
}
5453
}
5554

56-
// CHECK: @_backDeploy(before: iOS 15.0)
55+
// CHECK: @backDeployed(before: iOS 15.0)
5756
// CHECK: public func backDeployedFunc_iOSOnly() -> Swift.Int
5857
// CHECK-NOT: return 99
5958
@backDeployed(before: iOS 15.0)
6059
public func backDeployedFunc_iOSOnly() -> Int { return 99 }
6160

62-
// CHECK: @_backDeploy(before: macOS 12.0)
61+
// CHECK: @backDeployed(before: macOS 12.0)
6362
// CHECK: public func backDeployTopLevelFunc_macOS() -> Swift.Int {
6463
// CHECK-NEXT: return 47
6564
// CHECK-NEXT: }
@@ -75,12 +74,12 @@ public func backDeployTopLevelFunc_macOS() -> Int {
7574

7675
// MARK: - Availability macros
7776

78-
// CHECK: @_backDeploy(before: macOS 12.1)
77+
// CHECK: @backDeployed(before: macOS 12.1)
7978
// CHECK: public func backDeployTopLevelFunc_macOS12_1() -> Swift.Int { return 48 }
8079
@backDeployed(before: _macOS12_1)
8180
public func backDeployTopLevelFunc_macOS12_1() -> Int { return 48 }
8281

83-
// CHECK: @_backDeploy(before: macOS 12.1, iOS 15.1)
82+
// CHECK: @backDeployed(before: macOS 12.1, iOS 15.1)
8483
// CHECK: public func backDeployTopLevelFunc_myProject() -> Swift.Int { return 49 }
8584
@backDeployed(before: _myProject 1.0)
8685
public func backDeployTopLevelFunc_myProject() -> Int { return 49 }

0 commit comments

Comments
 (0)