@@ -330,86 +330,86 @@ getRemappedDeprecatedObsoletedVersionForFallbackPlatform(
330
330
return Mapping->mapDeprecatedObsoletedAvailabilityVersion (Version);
331
331
}
332
332
333
- bool AvailabilityInference::updateIntroducedPlatformForFallback (
334
- const SemanticAvailableAttr &attr, const ASTContext &Ctx ,
335
- llvm::StringRef &Platform , llvm::VersionTuple &PlatformVer ) {
336
- std::optional<llvm::VersionTuple> IntroducedVersion = attr.getIntroduced ();
333
+ bool AvailabilityInference::updateIntroducedAvailabilityDomainForFallback (
334
+ const SemanticAvailableAttr &attr, const ASTContext &ctx ,
335
+ AvailabilityDomain &domain , llvm::VersionTuple &platformVer ) {
336
+ std::optional<llvm::VersionTuple> introducedVersion = attr.getIntroduced ();
337
337
if (attr.getPlatform () == PlatformKind::iOS &&
338
- IntroducedVersion .has_value () &&
339
- isPlatformActive (PlatformKind::visionOS, Ctx .LangOpts )) {
338
+ introducedVersion .has_value () &&
339
+ isPlatformActive (PlatformKind::visionOS, ctx .LangOpts )) {
340
340
// We re-map the iOS introduced version to the corresponding visionOS version
341
- auto PotentiallyRemappedIntroducedVersion =
342
- getRemappedIntroducedVersionForFallbackPlatform (Ctx ,
343
- *IntroducedVersion );
344
- if (PotentiallyRemappedIntroducedVersion .has_value ()) {
345
- Platform = swift::prettyPlatformString (PlatformKind::visionOS);
346
- PlatformVer = PotentiallyRemappedIntroducedVersion .value ();
341
+ auto potentiallyRemappedIntroducedVersion =
342
+ getRemappedIntroducedVersionForFallbackPlatform (ctx ,
343
+ *introducedVersion );
344
+ if (potentiallyRemappedIntroducedVersion .has_value ()) {
345
+ domain = AvailabilityDomain::forPlatform (PlatformKind::visionOS);
346
+ platformVer = potentiallyRemappedIntroducedVersion .value ();
347
347
return true ;
348
348
}
349
349
}
350
350
return false ;
351
351
}
352
352
353
- bool AvailabilityInference::updateDeprecatedPlatformForFallback (
354
- const SemanticAvailableAttr &attr, const ASTContext &Ctx ,
355
- llvm::StringRef &Platform , llvm::VersionTuple &PlatformVer ) {
356
- std::optional<llvm::VersionTuple> DeprecatedVersion = attr.getDeprecated ();
353
+ bool AvailabilityInference::updateDeprecatedAvailabilityDomainForFallback (
354
+ const SemanticAvailableAttr &attr, const ASTContext &ctx ,
355
+ AvailabilityDomain &domain , llvm::VersionTuple &platformVer ) {
356
+ std::optional<llvm::VersionTuple> deprecatedVersion = attr.getDeprecated ();
357
357
if (attr.getPlatform () == PlatformKind::iOS &&
358
- DeprecatedVersion .has_value () &&
359
- isPlatformActive (PlatformKind::visionOS, Ctx .LangOpts )) {
358
+ deprecatedVersion .has_value () &&
359
+ isPlatformActive (PlatformKind::visionOS, ctx .LangOpts )) {
360
360
// We re-map the iOS deprecated version to the corresponding visionOS version
361
- auto PotentiallyRemappedDeprecatedVersion =
361
+ auto potentiallyRemappedDeprecatedVersion =
362
362
getRemappedDeprecatedObsoletedVersionForFallbackPlatform (
363
- Ctx , *DeprecatedVersion );
364
- if (PotentiallyRemappedDeprecatedVersion .has_value ()) {
365
- Platform = swift::prettyPlatformString (PlatformKind::visionOS);
366
- PlatformVer = PotentiallyRemappedDeprecatedVersion .value ();
363
+ ctx , *deprecatedVersion );
364
+ if (potentiallyRemappedDeprecatedVersion .has_value ()) {
365
+ domain = AvailabilityDomain::forPlatform (PlatformKind::visionOS);
366
+ platformVer = potentiallyRemappedDeprecatedVersion .value ();
367
367
return true ;
368
368
}
369
369
}
370
370
return false ;
371
371
}
372
372
373
- bool AvailabilityInference::updateObsoletedPlatformForFallback (
374
- const SemanticAvailableAttr &attr, const ASTContext &Ctx ,
375
- llvm::StringRef &Platform , llvm::VersionTuple &PlatformVer ) {
376
- std::optional<llvm::VersionTuple> ObsoletedVersion = attr.getObsoleted ();
377
- if (attr.getPlatform () == PlatformKind::iOS && ObsoletedVersion .has_value () &&
378
- isPlatformActive (PlatformKind::visionOS, Ctx .LangOpts )) {
373
+ bool AvailabilityInference::updateObsoletedAvailabilityDomainForFallback (
374
+ const SemanticAvailableAttr &attr, const ASTContext &ctx ,
375
+ AvailabilityDomain &domain , llvm::VersionTuple &platformVer ) {
376
+ std::optional<llvm::VersionTuple> obsoletedVersion = attr.getObsoleted ();
377
+ if (attr.getPlatform () == PlatformKind::iOS && obsoletedVersion .has_value () &&
378
+ isPlatformActive (PlatformKind::visionOS, ctx .LangOpts )) {
379
379
// We re-map the iOS obsoleted version to the corresponding visionOS version
380
- auto PotentiallyRemappedObsoletedVersion =
380
+ auto potentiallyRemappedObsoletedVersion =
381
381
getRemappedDeprecatedObsoletedVersionForFallbackPlatform (
382
- Ctx , *ObsoletedVersion );
383
- if (PotentiallyRemappedObsoletedVersion .has_value ()) {
384
- Platform = swift::prettyPlatformString (PlatformKind::visionOS);
385
- PlatformVer = PotentiallyRemappedObsoletedVersion .value ();
382
+ ctx , *obsoletedVersion );
383
+ if (potentiallyRemappedObsoletedVersion .has_value ()) {
384
+ domain = AvailabilityDomain::forPlatform (PlatformKind::visionOS);
385
+ platformVer = potentiallyRemappedObsoletedVersion .value ();
386
386
return true ;
387
387
}
388
388
}
389
389
return false ;
390
390
}
391
391
392
- void AvailabilityInference::updatePlatformStringForFallback (
392
+ void AvailabilityInference::updateAvailabilityDomainForFallback (
393
393
const SemanticAvailableAttr &attr, const ASTContext &Ctx,
394
- llvm::StringRef &Platform ) {
394
+ AvailabilityDomain &domain ) {
395
395
if (attr.getPlatform () == PlatformKind::iOS &&
396
396
isPlatformActive (PlatformKind::visionOS, Ctx.LangOpts )) {
397
- Platform = swift::prettyPlatformString (PlatformKind::visionOS);
397
+ domain = AvailabilityDomain::forPlatform (PlatformKind::visionOS);
398
398
}
399
399
}
400
400
401
- bool AvailabilityInference::updateBeforePlatformForFallback (
402
- const BackDeployedAttr *attr, const ASTContext &Ctx ,
403
- llvm::StringRef &Platform , llvm::VersionTuple &PlatformVer ) {
404
- auto BeforeVersion = attr->Version ;
401
+ bool AvailabilityInference::updateBeforeAvailabilityDomainForFallback (
402
+ const BackDeployedAttr *attr, const ASTContext &ctx ,
403
+ AvailabilityDomain &domain , llvm::VersionTuple &platformVer ) {
404
+ auto beforeVersion = attr->Version ;
405
405
if (attr->Platform == PlatformKind::iOS &&
406
- isPlatformActive (PlatformKind::visionOS, Ctx .LangOpts )) {
406
+ isPlatformActive (PlatformKind::visionOS, ctx .LangOpts )) {
407
407
// We re-map the iOS before version to the corresponding visionOS version
408
408
auto PotentiallyRemappedIntroducedVersion =
409
- getRemappedIntroducedVersionForFallbackPlatform (Ctx, BeforeVersion );
409
+ getRemappedIntroducedVersionForFallbackPlatform (ctx, beforeVersion );
410
410
if (PotentiallyRemappedIntroducedVersion.has_value ()) {
411
- Platform = swift::prettyPlatformString (PlatformKind::visionOS);
412
- PlatformVer = PotentiallyRemappedIntroducedVersion.value ();
411
+ domain = AvailabilityDomain::forPlatform (PlatformKind::visionOS);
412
+ platformVer = PotentiallyRemappedIntroducedVersion.value ();
413
413
return true ;
414
414
}
415
415
}
@@ -492,10 +492,10 @@ std::optional<SemanticAvailableAttr> Decl::getDeprecatedAttr() const {
492
492
493
493
auto deprecatedVersion = attr.getDeprecated ();
494
494
495
- StringRef deprecatedPlatform ;
495
+ AvailabilityDomain unusedDomain ;
496
496
llvm::VersionTuple remappedDeprecatedVersion;
497
- if (AvailabilityInference::updateDeprecatedPlatformForFallback (
498
- attr, ctx, deprecatedPlatform , remappedDeprecatedVersion))
497
+ if (AvailabilityInference::updateDeprecatedAvailabilityDomainForFallback (
498
+ attr, ctx, unusedDomain , remappedDeprecatedVersion))
499
499
deprecatedVersion = remappedDeprecatedVersion;
500
500
501
501
if (!deprecatedVersion.has_value ())
@@ -892,10 +892,10 @@ SemanticAvailableAttr::getIntroducedRange(const ASTContext &Ctx) const {
892
892
return AvailabilityRange::alwaysAvailable ();
893
893
894
894
llvm::VersionTuple IntroducedVersion = getIntroduced ().value ();
895
- StringRef Platform ;
895
+ AvailabilityDomain UnusedDomain ;
896
896
llvm::VersionTuple RemappedIntroducedVersion;
897
- if (AvailabilityInference::updateIntroducedPlatformForFallback (
898
- *this , Ctx, Platform , RemappedIntroducedVersion))
897
+ if (AvailabilityInference::updateIntroducedAvailabilityDomainForFallback (
898
+ *this , Ctx, UnusedDomain , RemappedIntroducedVersion))
899
899
IntroducedVersion = RemappedIntroducedVersion;
900
900
901
901
return AvailabilityRange{VersionRange::allGTE (IntroducedVersion)};
0 commit comments