@@ -830,11 +830,10 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
830830 if (!semanticAttr)
831831 continue ;
832832
833- auto domain = semanticAttr->getDomain ();
834833 if (isShortAvailable (*semanticAttr)) {
835- if (domain. isSwiftLanguage ())
834+ if (semanticAttr-> isSwiftLanguageModeSpecific ())
836835 swiftVersionAvailableAttribute.emplace (*semanticAttr);
837- else if (domain. isPackageDescription ())
836+ else if (semanticAttr-> isPackageDescriptionVersionSpecific ())
838837 packageDescriptionVersionAvailableAttribute.emplace (*semanticAttr);
839838 else
840839 shortAvailableAttributes.push_back (*semanticAttr);
@@ -2169,32 +2168,6 @@ OriginallyDefinedInAttr *OriginallyDefinedInAttr::clone(ASTContext &C,
21692168 OriginalModuleName, Platform, MovedVersion, implicit);
21702169}
21712170
2172- bool AvailableAttr::isLanguageVersionSpecific () const {
2173- if (getPlatformAgnosticAvailability () ==
2174- PlatformAgnosticAvailabilityKind::SwiftVersionSpecific)
2175- {
2176- assert (getPlatform () == PlatformKind::none &&
2177- (Introduced.has_value () ||
2178- Deprecated.has_value () ||
2179- Obsoleted.has_value ()));
2180- return true ;
2181- }
2182- return false ;
2183- }
2184-
2185- bool AvailableAttr::isPackageDescriptionVersionSpecific () const {
2186- if (getPlatformAgnosticAvailability () ==
2187- PlatformAgnosticAvailabilityKind::PackageDescriptionVersionSpecific)
2188- {
2189- assert (getPlatform () == PlatformKind::none &&
2190- (Introduced.has_value () ||
2191- Deprecated.has_value () ||
2192- Obsoleted.has_value ()));
2193- return true ;
2194- }
2195- return false ;
2196- }
2197-
21982171bool AvailableAttr::isUnconditionallyUnavailable () const {
21992172 switch (getPlatformAgnosticAvailability ()) {
22002173 case PlatformAgnosticAvailabilityKind::None:
@@ -2234,8 +2207,9 @@ bool AvailableAttr::isNoAsync() const {
22342207 PlatformAgnosticAvailabilityKind::NoAsync;
22352208}
22362209
2237- llvm::VersionTuple AvailableAttr::getActiveVersion (const ASTContext &ctx) const {
2238- if (isLanguageVersionSpecific ()) {
2210+ llvm::VersionTuple
2211+ SemanticAvailableAttr::getActiveVersion (const ASTContext &ctx) const {
2212+ if (isSwiftLanguageModeSpecific ()) {
22392213 return ctx.LangOpts .EffectiveLanguageVersion ;
22402214 } else if (isPackageDescriptionVersionSpecific ()) {
22412215 return ctx.LangOpts .PackageDescriptionVersion ;
@@ -2244,32 +2218,32 @@ llvm::VersionTuple AvailableAttr::getActiveVersion(const ASTContext &ctx) const
22442218 }
22452219}
22462220
2247- AvailableVersionComparison AvailableAttr::getVersionAvailability (
2248- const ASTContext &ctx) const {
2221+ AvailableVersionComparison
2222+ SemanticAvailableAttr::getVersionAvailability ( const ASTContext &ctx) const {
22492223
22502224 // Unconditional unavailability.
2251- if (isUnconditionallyUnavailable ())
2225+ if (attr-> isUnconditionallyUnavailable ())
22522226 return AvailableVersionComparison::Unavailable;
22532227
22542228 llvm::VersionTuple queryVersion = getActiveVersion (ctx);
2255- std::optional<llvm::VersionTuple> ObsoletedVersion = Obsoleted;
2229+ std::optional<llvm::VersionTuple> ObsoletedVersion = attr-> Obsoleted ;
22562230
2257- StringRef ObsoletedPlatform = prettyPlatformString () ;
2231+ StringRef ObsoletedPlatform;
22582232 llvm::VersionTuple RemappedObsoletedVersion;
22592233 if (AvailabilityInference::updateObsoletedPlatformForFallback (
2260- this , ctx, ObsoletedPlatform, RemappedObsoletedVersion))
2234+ attr , ctx, ObsoletedPlatform, RemappedObsoletedVersion))
22612235 ObsoletedVersion = RemappedObsoletedVersion;
22622236
22632237 // If this entity was obsoleted before or at the query platform version,
22642238 // consider it obsolete.
22652239 if (ObsoletedVersion && *ObsoletedVersion <= queryVersion)
22662240 return AvailableVersionComparison::Obsoleted;
22672241
2268- std::optional<llvm::VersionTuple> IntroducedVersion = Introduced;
2269- StringRef IntroducedPlatform = prettyPlatformString () ;
2242+ std::optional<llvm::VersionTuple> IntroducedVersion = attr-> Introduced ;
2243+ StringRef IntroducedPlatform;
22702244 llvm::VersionTuple RemappedIntroducedVersion;
22712245 if (AvailabilityInference::updateIntroducedPlatformForFallback (
2272- this , ctx, IntroducedPlatform, RemappedIntroducedVersion))
2246+ attr , ctx, IntroducedPlatform, RemappedIntroducedVersion))
22732247 IntroducedVersion = RemappedIntroducedVersion;
22742248
22752249 // If this entity was introduced after the query version and we're doing a
@@ -2278,7 +2252,7 @@ AvailableVersionComparison AvailableAttr::getVersionAvailability(
22782252 // static requirement, so we treat "introduced later" as just plain
22792253 // unavailable.
22802254 if (IntroducedVersion && *IntroducedVersion > queryVersion) {
2281- if (isLanguageVersionSpecific () || isPackageDescriptionVersionSpecific ())
2255+ if (isSwiftLanguageModeSpecific () || isPackageDescriptionVersionSpecific ())
22822256 return AvailableVersionComparison::Unavailable;
22832257 else
22842258 return AvailableVersionComparison::PotentiallyUnavailable;
0 commit comments