@@ -830,11 +830,10 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
830
830
if (!semanticAttr)
831
831
continue ;
832
832
833
- auto domain = semanticAttr->getDomain ();
834
833
if (isShortAvailable (*semanticAttr)) {
835
- if (domain. isSwiftLanguage ())
834
+ if (semanticAttr-> isSwiftLanguageModeSpecific ())
836
835
swiftVersionAvailableAttribute.emplace (*semanticAttr);
837
- else if (domain. isPackageDescription ())
836
+ else if (semanticAttr-> isPackageDescriptionVersionSpecific ())
838
837
packageDescriptionVersionAvailableAttribute.emplace (*semanticAttr);
839
838
else
840
839
shortAvailableAttributes.push_back (*semanticAttr);
@@ -2169,32 +2168,6 @@ OriginallyDefinedInAttr *OriginallyDefinedInAttr::clone(ASTContext &C,
2169
2168
OriginalModuleName, Platform, MovedVersion, implicit);
2170
2169
}
2171
2170
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
-
2198
2171
bool AvailableAttr::isUnconditionallyUnavailable () const {
2199
2172
switch (getPlatformAgnosticAvailability ()) {
2200
2173
case PlatformAgnosticAvailabilityKind::None:
@@ -2234,8 +2207,9 @@ bool AvailableAttr::isNoAsync() const {
2234
2207
PlatformAgnosticAvailabilityKind::NoAsync;
2235
2208
}
2236
2209
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 ()) {
2239
2213
return ctx.LangOpts .EffectiveLanguageVersion ;
2240
2214
} else if (isPackageDescriptionVersionSpecific ()) {
2241
2215
return ctx.LangOpts .PackageDescriptionVersion ;
@@ -2244,32 +2218,32 @@ llvm::VersionTuple AvailableAttr::getActiveVersion(const ASTContext &ctx) const
2244
2218
}
2245
2219
}
2246
2220
2247
- AvailableVersionComparison AvailableAttr::getVersionAvailability (
2248
- const ASTContext &ctx) const {
2221
+ AvailableVersionComparison
2222
+ SemanticAvailableAttr::getVersionAvailability ( const ASTContext &ctx) const {
2249
2223
2250
2224
// Unconditional unavailability.
2251
- if (isUnconditionallyUnavailable ())
2225
+ if (attr-> isUnconditionallyUnavailable ())
2252
2226
return AvailableVersionComparison::Unavailable;
2253
2227
2254
2228
llvm::VersionTuple queryVersion = getActiveVersion (ctx);
2255
- std::optional<llvm::VersionTuple> ObsoletedVersion = Obsoleted;
2229
+ std::optional<llvm::VersionTuple> ObsoletedVersion = attr-> Obsoleted ;
2256
2230
2257
- StringRef ObsoletedPlatform = prettyPlatformString () ;
2231
+ StringRef ObsoletedPlatform;
2258
2232
llvm::VersionTuple RemappedObsoletedVersion;
2259
2233
if (AvailabilityInference::updateObsoletedPlatformForFallback (
2260
- this , ctx, ObsoletedPlatform, RemappedObsoletedVersion))
2234
+ attr , ctx, ObsoletedPlatform, RemappedObsoletedVersion))
2261
2235
ObsoletedVersion = RemappedObsoletedVersion;
2262
2236
2263
2237
// If this entity was obsoleted before or at the query platform version,
2264
2238
// consider it obsolete.
2265
2239
if (ObsoletedVersion && *ObsoletedVersion <= queryVersion)
2266
2240
return AvailableVersionComparison::Obsoleted;
2267
2241
2268
- std::optional<llvm::VersionTuple> IntroducedVersion = Introduced;
2269
- StringRef IntroducedPlatform = prettyPlatformString () ;
2242
+ std::optional<llvm::VersionTuple> IntroducedVersion = attr-> Introduced ;
2243
+ StringRef IntroducedPlatform;
2270
2244
llvm::VersionTuple RemappedIntroducedVersion;
2271
2245
if (AvailabilityInference::updateIntroducedPlatformForFallback (
2272
- this , ctx, IntroducedPlatform, RemappedIntroducedVersion))
2246
+ attr , ctx, IntroducedPlatform, RemappedIntroducedVersion))
2273
2247
IntroducedVersion = RemappedIntroducedVersion;
2274
2248
2275
2249
// If this entity was introduced after the query version and we're doing a
@@ -2278,7 +2252,7 @@ AvailableVersionComparison AvailableAttr::getVersionAvailability(
2278
2252
// static requirement, so we treat "introduced later" as just plain
2279
2253
// unavailable.
2280
2254
if (IntroducedVersion && *IntroducedVersion > queryVersion) {
2281
- if (isLanguageVersionSpecific () || isPackageDescriptionVersionSpecific ())
2255
+ if (isSwiftLanguageModeSpecific () || isPackageDescriptionVersionSpecific ())
2282
2256
return AvailableVersionComparison::Unavailable;
2283
2257
else
2284
2258
return AvailableVersionComparison::PotentiallyUnavailable;
0 commit comments