|
20 | 20 | #include "TypeChecker.h"
|
21 | 21 | #include "swift/AST/ASTContext.h"
|
22 | 22 | #include "swift/AST/ASTPrinter.h"
|
23 |
| -#include "swift/AST/AvailabilityInference.h" |
24 | 23 | #include "swift/AST/Decl.h"
|
25 | 24 | #include "swift/AST/ExistentialLayout.h"
|
26 | 25 | #include "swift/AST/ForeignErrorConvention.h"
|
@@ -553,32 +552,30 @@ static bool checkObjCActorIsolation(const ValueDecl *VD, ObjCReason Reason) {
|
553 | 552 | }
|
554 | 553 | }
|
555 | 554 |
|
556 |
| -static VersionRange getMinOSVersionForClassStubs(const llvm::Triple &target) { |
| 555 | +static AvailabilityRange getObjCClassStubAvailability(ASTContext &ctx) { |
| 556 | + // FIXME: This should just be ctx.getSwift51Availability(), but that breaks |
| 557 | + // tests on arm64 arches. |
| 558 | + const llvm::Triple &target = ctx.LangOpts.Target; |
557 | 559 | if (target.isMacOSX())
|
558 |
| - return VersionRange::allGTE(llvm::VersionTuple(10, 15, 0)); |
| 560 | + return AvailabilityRange(llvm::VersionTuple(10, 15, 0)); |
559 | 561 | if (target.isiOS()) // also returns true on tvOS
|
560 |
| - return VersionRange::allGTE(llvm::VersionTuple(13, 0, 0)); |
| 562 | + return AvailabilityRange(llvm::VersionTuple(13, 0, 0)); |
561 | 563 | if (target.isWatchOS())
|
562 |
| - return VersionRange::allGTE(llvm::VersionTuple(6, 0, 0)); |
| 564 | + return AvailabilityRange(llvm::VersionTuple(6, 0, 0)); |
563 | 565 | if (target.isXROS())
|
564 |
| - return VersionRange::allGTE(llvm::VersionTuple(1, 0, 0)); |
565 |
| - return VersionRange::all(); |
566 |
| -} |
567 |
| - |
568 |
| -static AvailabilityRange getObjCClassStubAvailability(ASTContext &ctx) { |
569 |
| - // FIXME: This should just be ctx.getSwift51Availability(), but that breaks |
570 |
| - // tests on arm64 arches. |
571 |
| - return AvailabilityRange(getMinOSVersionForClassStubs(ctx.LangOpts.Target)); |
| 566 | + return AvailabilityRange(llvm::VersionTuple(1, 0, 0)); |
| 567 | + return AvailabilityRange::alwaysAvailable(); |
572 | 568 | }
|
573 | 569 |
|
574 | 570 | static bool checkObjCClassStubAvailability(ASTContext &ctx, const Decl *decl) {
|
575 |
| - auto stubAvailability = getObjCClassStubAvailability(ctx); |
| 571 | + auto stubAvailability = AvailabilityContext::forPlatformRange( |
| 572 | + getObjCClassStubAvailability(ctx), ctx); |
576 | 573 |
|
577 |
| - auto deploymentTarget = AvailabilityRange::forDeploymentTarget(ctx); |
| 574 | + auto deploymentTarget = AvailabilityContext::forDeploymentTarget(ctx); |
578 | 575 | if (deploymentTarget.isContainedIn(stubAvailability))
|
579 | 576 | return true;
|
580 | 577 |
|
581 |
| - auto declAvailability = AvailabilityInference::availableRange(decl); |
| 578 | + auto declAvailability = AvailabilityContext::forDeclSignature(decl); |
582 | 579 | return declAvailability.isContainedIn(stubAvailability);
|
583 | 580 | }
|
584 | 581 |
|
|
0 commit comments