Skip to content

Commit a5a49aa

Browse files
committed
ModuleInterface: Stop printing $CustomAvailability guards in swiftinterfaces.
All supported compilers can now parse `@available` attributes that reference custom availability domains.
1 parent 61cb1a9 commit a5a49aa

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

lib/AST/FeatureSet.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,7 @@ static bool usesFeatureCoroutineAccessors(Decl *decl) {
354354
}
355355

356356
UNINTERESTING_FEATURE(GeneralizedIsSameMetaTypeBuiltin)
357-
358-
static bool usesFeatureCustomAvailability(Decl *decl) {
359-
for (auto attr : decl->getSemanticAvailableAttrs()) {
360-
if (attr.getDomain().isCustom())
361-
return true;
362-
}
363-
return false;
364-
}
357+
UNINTERESTING_FEATURE(CustomAvailability)
365358

366359
static bool usesFeatureAsyncExecutionBehaviorAttributes(Decl *decl) {
367360
// Explicit `@concurrent` attribute on the declaration.

test/ModuleInterface/availability_custom_domains.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@
1515

1616
import Oceans // re-exports Rivers
1717

18-
// CHECK: #if compiler(>=5.3) && $CustomAvailability
19-
// CHECK-NEXT: @available(Colorado)
18+
// CHECK-NOT: $CustomAvailability
19+
20+
// CHECK: @available(Colorado)
2021
// CHECK-NEXT: public func availableInColorado()
21-
// CHECK-NEXT: #endif
2222
@available(Colorado)
2323
public func availableInColorado() { }
2424

25-
// CHECK: #if compiler(>=5.3) && $CustomAvailability
26-
// CHECK-NEXT: @available(Arctic, unavailable)
25+
// CHECK: @available(Arctic, unavailable)
2726
// CHECK-NEXT: @available(Pacific)
2827
// CHECK-NEXT: public func unavailableInArcticButAvailableInPacific()
29-
// CHECK-NEXT: #endif
3028
@available(Arctic, unavailable)
3129
@available(Pacific)
3230
public func unavailableInArcticButAvailableInPacific() { }

0 commit comments

Comments
 (0)