@@ -288,13 +288,6 @@ static bool shouldTreatDeclContextAsAsyncForDiagnostics(const DeclContext *DC) {
288
288
return DC->isAsyncContext ();
289
289
}
290
290
291
- AvailabilityRange TypeChecker::overApproximateAvailabilityAtLocation (
292
- SourceLoc loc, const DeclContext *DC,
293
- const AvailabilityScope **MostRefined) {
294
- return AvailabilityContext::forLocation (loc, DC, MostRefined)
295
- .getPlatformRange ();
296
- }
297
-
298
291
// / A class that walks the AST to find the innermost (i.e., deepest) node that
299
292
// / contains a target SourceRange and matches a particular criterion.
300
293
// / This class finds the innermost nodes of interest by walking
@@ -689,8 +682,8 @@ static bool fixAvailabilityByNarrowingNearbyVersionCheck(
689
682
return false ;
690
683
691
684
const AvailabilityScope *scope = nullptr ;
692
- (void )TypeChecker::overApproximateAvailabilityAtLocation (ReferenceRange.Start ,
693
- ReferenceDC, &scope);
685
+ (void )AvailabilityContext::forLocation (ReferenceRange.Start , ReferenceDC ,
686
+ &scope);
694
687
if (!scope)
695
688
return false ;
696
689
@@ -866,7 +859,7 @@ static void diagnosePotentialUnavailability(
866
859
// FIXME: [availability] Should this take an AvailabilityContext instead of
867
860
// AvailabilityRange?
868
861
bool TypeChecker::checkAvailability (SourceRange ReferenceRange,
869
- AvailabilityRange RequiredAvailability ,
862
+ AvailabilityRange PlatformRange ,
870
863
const DeclContext *ReferenceDC,
871
864
llvm::function_ref<InFlightDiagnostic(
872
865
AvailabilityDomain, AvailabilityRange)>
@@ -880,24 +873,25 @@ bool TypeChecker::checkAvailability(SourceRange ReferenceRange,
880
873
return false ;
881
874
882
875
auto availabilityAtLocation =
883
- TypeChecker::overApproximateAvailabilityAtLocation (ReferenceRange.Start ,
884
- ReferenceDC);
885
- if (!availabilityAtLocation.isContainedIn (RequiredAvailability)) {
876
+ AvailabilityContext::forLocation (ReferenceRange.Start , ReferenceDC)
877
+ .getPlatformRange ();
878
+
879
+ if (!availabilityAtLocation.isContainedIn (PlatformRange)) {
886
880
diagnosePotentialUnavailability (ReferenceRange, Diagnose, ReferenceDC,
887
- domain, RequiredAvailability );
881
+ domain, PlatformRange );
888
882
return true ;
889
883
}
890
884
891
885
return false ;
892
886
}
893
887
894
888
bool TypeChecker::checkAvailability (
895
- SourceRange ReferenceRange, AvailabilityRange RequiredAvailability ,
889
+ SourceRange ReferenceRange, AvailabilityRange PlatformRange ,
896
890
Diag<AvailabilityDomain, AvailabilityRange> Diag,
897
891
const DeclContext *ReferenceDC) {
898
892
auto &Diags = ReferenceDC->getASTContext ().Diags ;
899
893
return TypeChecker::checkAvailability (
900
- ReferenceRange, RequiredAvailability , ReferenceDC,
894
+ ReferenceRange, PlatformRange , ReferenceDC,
901
895
[&](AvailabilityDomain domain, AvailabilityRange range) {
902
896
return Diags.diagnose (ReferenceRange.Start , Diag, domain, range);
903
897
});
0 commit comments