@@ -379,8 +379,7 @@ DeclAttributes::isUnavailableInSwiftVersion(
379379 if (available->isInvalid ())
380380 continue ;
381381
382- if (available->getPlatformAgnosticAvailability () ==
383- PlatformAgnosticAvailabilityKind::SwiftVersionSpecific) {
382+ if (available->isLanguageVersionSpecific ()) {
384383 if (available->Introduced .has_value () &&
385384 available->Introduced .value () > vers)
386385 return true ;
@@ -413,13 +412,14 @@ DeclAttributes::findMostSpecificActivePlatform(const ASTContext &ctx,
413412 if (!avAttr->isActivePlatform (ctx))
414413 continue ;
415414
416- if (ignoreAppExtensions && isApplicationExtensionPlatform (avAttr->Platform ))
415+ if (ignoreAppExtensions &&
416+ isApplicationExtensionPlatform (avAttr->getPlatform ()))
417417 continue ;
418418
419419 // We have an attribute that is active for the platform, but
420420 // is it more specific than our current best?
421- if (!bestAttr || inheritsAvailabilityFromPlatform (avAttr-> Platform ,
422- bestAttr->Platform )) {
421+ if (!bestAttr || inheritsAvailabilityFromPlatform (
422+ avAttr-> getPlatform (), bestAttr->getPlatform () )) {
423423 bestAttr = avAttr;
424424 }
425425 }
@@ -452,7 +452,7 @@ DeclAttributes::getUnavailable(const ASTContext &ctx,
452452 continue ;
453453
454454 if (ignoreAppExtensions &&
455- isApplicationExtensionPlatform (AvAttr->Platform ))
455+ isApplicationExtensionPlatform (AvAttr->getPlatform () ))
456456 continue ;
457457
458458 // Unconditional unavailable.
@@ -582,8 +582,8 @@ const AvailableAttr *DeclAttributes::getNoAsync(const ASTContext &ctx) const {
582582 bestAttr = avAttr;
583583 } else if (bestAttr && avAttr->hasPlatform () &&
584584 bestAttr->hasPlatform () &&
585- inheritsAvailabilityFromPlatform (avAttr->Platform ,
586- bestAttr->Platform )) {
585+ inheritsAvailabilityFromPlatform (avAttr->getPlatform () ,
586+ bestAttr->getPlatform () )) {
587587 // if they both have a viable platform, use the better one
588588 bestAttr = avAttr;
589589 } else if (avAttr->hasPlatform () && !bestAttr->hasPlatform ()) {
@@ -655,7 +655,7 @@ static bool isShortAvailable(const DeclAttribute *DA) {
655655 if (!AvailAttr->Rename .empty ())
656656 return false ;
657657
658- switch (AvailAttr->PlatformAgnostic ) {
658+ switch (AvailAttr->getPlatformAgnosticAvailability () ) {
659659 case PlatformAgnosticAvailabilityKind::Deprecated:
660660 case PlatformAgnosticAvailabilityKind::Unavailable:
661661 case PlatformAgnosticAvailabilityKind::UnavailableInSwift:
@@ -682,10 +682,11 @@ static bool isShortFormAvailabilityImpliedByOther(const AvailableAttr *Attr,
682682
683683 for (auto *DA : Others) {
684684 auto *Other = cast<AvailableAttr>(DA);
685- if (Attr->Platform == Other->Platform )
685+ if (Attr->getPlatform () == Other->getPlatform () )
686686 continue ;
687687
688- if (!inheritsAvailabilityFromPlatform (Attr->Platform , Other->Platform ))
688+ if (!inheritsAvailabilityFromPlatform (Attr->getPlatform (),
689+ Other->getPlatform ()))
689690 continue ;
690691
691692 if (Attr->Introduced == Other->Introduced )
@@ -730,7 +731,7 @@ static void printShortFormAvailable(ArrayRef<const DeclAttribute *> Attrs,
730731 if (!Options.IsForSwiftInterface &&
731732 isShortFormAvailabilityImpliedByOther (AvailAttr, Attrs))
732733 continue ;
733- Printer << platformString (AvailAttr->Platform ) << " "
734+ Printer << platformString (AvailAttr->getPlatform () ) << " "
734735 << AvailAttr->Introduced .value ().getAsString () << " , " ;
735736 }
736737 Printer << " *" ;
@@ -959,7 +960,7 @@ static std::optional<PlatformKind>
959960referencedPlatform (const DeclAttribute *attr) {
960961 switch (attr->getKind ()) {
961962 case DeclAttrKind::Available:
962- return static_cast <const AvailableAttr *>(attr)->Platform ;
963+ return static_cast <const AvailableAttr *>(attr)->getPlatform () ;
963964 case DeclAttrKind::BackDeployed:
964965 return static_cast <const BackDeployedAttr *>(attr)->Platform ;
965966 case DeclAttrKind::OriginallyDefinedIn:
@@ -2232,15 +2233,16 @@ AvailableAttr::AvailableAttr(
22322233 Message(Message), Rename(Rename), RenameDecl(RenameDecl),
22332234 INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
22342235 INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
2235- INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange),
2236- PlatformAgnostic(PlatformAgnostic), Platform(Platform) {
2236+ INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange) {
2237+ Bits.AvailableAttr .Platform = static_cast <uint8_t >(Platform);
2238+ Bits.AvailableAttr .PlatformAgnostic = static_cast <uint8_t >(PlatformAgnostic);
22372239 Bits.AvailableAttr .IsSPI = IsSPI;
22382240
22392241 if (IsForEmbedded) {
22402242 // FIXME: The IsForEmbedded bit should be removed when library availability
22412243 // conditions are implemented (rdar://138802876)
22422244 Bits.AvailableAttr .IsForEmbedded = true ;
2243- assert (Platform == PlatformKind::none);
2245+ assert (getPlatform () == PlatformKind::none);
22442246 }
22452247}
22462248
@@ -2277,7 +2279,7 @@ AvailableAttr *AvailableAttr::createForAlternative(
22772279}
22782280
22792281bool AvailableAttr::isActivePlatform (const ASTContext &ctx) const {
2280- return isPlatformActive (Platform , ctx.LangOpts );
2282+ return isPlatformActive (getPlatform () , ctx.LangOpts );
22812283}
22822284
22832285bool BackDeployedAttr::isActivePlatform (const ASTContext &ctx,
@@ -2288,14 +2290,14 @@ bool BackDeployedAttr::isActivePlatform(const ASTContext &ctx,
22882290AvailableAttr *AvailableAttr::clone (ASTContext &C, bool implicit) const {
22892291 return new (C) AvailableAttr (implicit ? SourceLoc () : AtLoc,
22902292 implicit ? SourceRange () : getRange (),
2291- Platform , Message, Rename, RenameDecl,
2293+ getPlatform () , Message, Rename, RenameDecl,
22922294 Introduced ? *Introduced : llvm::VersionTuple (),
22932295 implicit ? SourceRange () : IntroducedRange,
22942296 Deprecated ? *Deprecated : llvm::VersionTuple (),
22952297 implicit ? SourceRange () : DeprecatedRange,
22962298 Obsoleted ? *Obsoleted : llvm::VersionTuple (),
22972299 implicit ? SourceRange () : ObsoletedRange,
2298- PlatformAgnostic ,
2300+ getPlatformAgnosticAvailability () ,
22992301 implicit,
23002302 isSPI (),
23012303 isForEmbedded ());
@@ -2330,10 +2332,10 @@ OriginallyDefinedInAttr *OriginallyDefinedInAttr::clone(ASTContext &C,
23302332}
23312333
23322334bool AvailableAttr::isLanguageVersionSpecific () const {
2333- if (PlatformAgnostic ==
2335+ if (getPlatformAgnosticAvailability () ==
23342336 PlatformAgnosticAvailabilityKind::SwiftVersionSpecific)
23352337 {
2336- assert (Platform == PlatformKind::none &&
2338+ assert (getPlatform () == PlatformKind::none &&
23372339 (Introduced.has_value () ||
23382340 Deprecated.has_value () ||
23392341 Obsoleted.has_value ()));
@@ -2343,10 +2345,10 @@ bool AvailableAttr::isLanguageVersionSpecific() const {
23432345}
23442346
23452347bool AvailableAttr::isPackageDescriptionVersionSpecific () const {
2346- if (PlatformAgnostic ==
2348+ if (getPlatformAgnosticAvailability () ==
23472349 PlatformAgnosticAvailabilityKind::PackageDescriptionVersionSpecific)
23482350 {
2349- assert (Platform == PlatformKind::none &&
2351+ assert (getPlatform () == PlatformKind::none &&
23502352 (Introduced.has_value () ||
23512353 Deprecated.has_value () ||
23522354 Obsoleted.has_value ()));
@@ -2356,7 +2358,7 @@ bool AvailableAttr::isPackageDescriptionVersionSpecific() const {
23562358}
23572359
23582360bool AvailableAttr::isUnconditionallyUnavailable () const {
2359- switch (PlatformAgnostic ) {
2361+ switch (getPlatformAgnosticAvailability () ) {
23602362 case PlatformAgnosticAvailabilityKind::None:
23612363 case PlatformAgnosticAvailabilityKind::Deprecated:
23622364 case PlatformAgnosticAvailabilityKind::SwiftVersionSpecific:
@@ -2373,7 +2375,7 @@ bool AvailableAttr::isUnconditionallyUnavailable() const {
23732375}
23742376
23752377bool AvailableAttr::isUnconditionallyDeprecated () const {
2376- switch (PlatformAgnostic ) {
2378+ switch (getPlatformAgnosticAvailability () ) {
23772379 case PlatformAgnosticAvailabilityKind::None:
23782380 case PlatformAgnosticAvailabilityKind::Unavailable:
23792381 case PlatformAgnosticAvailabilityKind::UnavailableInSwift:
@@ -2390,7 +2392,8 @@ bool AvailableAttr::isUnconditionallyDeprecated() const {
23902392}
23912393
23922394bool AvailableAttr::isNoAsync () const {
2393- return PlatformAgnostic == PlatformAgnosticAvailabilityKind::NoAsync;
2395+ return getPlatformAgnosticAvailability () ==
2396+ PlatformAgnosticAvailabilityKind::NoAsync;
23942397}
23952398
23962399llvm::VersionTuple AvailableAttr::getActiveVersion (const ASTContext &ctx) const {
0 commit comments