@@ -2106,20 +2106,18 @@ Type RawLayoutAttr::getResolvedCountType(StructDecl *sd) const {
2106
2106
#define INIT_VER_TUPLE (X ) X(X.empty() ? std::optional<llvm::VersionTuple>() : X)
2107
2107
2108
2108
AvailableAttr::AvailableAttr (
2109
- SourceLoc AtLoc, SourceRange Range, PlatformKind Platform ,
2110
- StringRef Message, StringRef Rename,
2109
+ SourceLoc AtLoc, SourceRange Range, const AvailabilityDomain &Domain ,
2110
+ Kind Kind, StringRef Message, StringRef Rename,
2111
2111
const llvm::VersionTuple &Introduced, SourceRange IntroducedRange,
2112
2112
const llvm::VersionTuple &Deprecated, SourceRange DeprecatedRange,
2113
2113
const llvm::VersionTuple &Obsoleted, SourceRange ObsoletedRange,
2114
- PlatformAgnosticAvailabilityKind PlatformAgnostic, bool Implicit,
2115
- bool IsSPI, bool IsForEmbedded)
2114
+ bool Implicit, bool IsSPI, bool IsForEmbedded)
2116
2115
: DeclAttribute(DeclAttrKind::Available, AtLoc, Range, Implicit),
2117
- Message(Message), Rename(Rename),
2116
+ Domain(Domain), Message(Message), Rename(Rename),
2118
2117
INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
2119
2118
INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
2120
2119
INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange) {
2121
- Bits.AvailableAttr .Platform = static_cast <uint8_t >(Platform);
2122
- Bits.AvailableAttr .PlatformAgnostic = static_cast <uint8_t >(PlatformAgnostic);
2120
+ Bits.AvailableAttr .Kind = static_cast <uint8_t >(Kind);
2123
2121
Bits.AvailableAttr .HasComputedRenamedDecl = false ;
2124
2122
Bits.AvailableAttr .HasRenamedDecl = false ;
2125
2123
Bits.AvailableAttr .IsSPI = IsSPI;
@@ -2128,52 +2126,10 @@ AvailableAttr::AvailableAttr(
2128
2126
// FIXME: [availability] The IsForEmbedded bit should be removed when
2129
2127
// it can be represented with AvailabilityDomain (rdar://138802876)
2130
2128
Bits.AvailableAttr .IsForEmbedded = true ;
2131
- assert (getPlatform () == PlatformKind::none);
2132
- }
2133
- }
2134
-
2135
- static PlatformAgnosticAvailabilityKind
2136
- platformAgnosticFromDomainAndKind (const AvailabilityDomain &Domain,
2137
- AvailableAttr::Kind Kind) {
2138
- switch (Kind) {
2139
- case swift::AvailableAttr::Kind::NoAsync:
2140
- return PlatformAgnosticAvailabilityKind::NoAsync;
2141
-
2142
- case swift::AvailableAttr::Kind::Default:
2143
- if (Domain.isSwiftLanguage ()) {
2144
- return PlatformAgnosticAvailabilityKind::SwiftVersionSpecific;
2145
- } else if (Domain.isPackageDescription ()) {
2146
- return PlatformAgnosticAvailabilityKind::
2147
- PackageDescriptionVersionSpecific;
2148
- }
2149
- return PlatformAgnosticAvailabilityKind::None;
2150
-
2151
- case swift::AvailableAttr::Kind::Deprecated:
2152
- return PlatformAgnosticAvailabilityKind::Deprecated;
2153
-
2154
- case swift::AvailableAttr::Kind::Unavailable:
2155
- if (Domain.isSwiftLanguage ()) {
2156
- return PlatformAgnosticAvailabilityKind::UnavailableInSwift;
2157
- } else if (Domain.isUniversal () || Domain.isPlatform ()) {
2158
- return PlatformAgnosticAvailabilityKind::Unavailable;
2159
- }
2160
- llvm_unreachable (" unexpected domain for unavailable attr" );
2129
+ assert (Domain.isUniversal ());
2161
2130
}
2162
2131
}
2163
2132
2164
- AvailableAttr::AvailableAttr (
2165
- SourceLoc AtLoc, SourceRange Range, const AvailabilityDomain &Domain,
2166
- Kind Kind, StringRef Message, StringRef Rename,
2167
- const llvm::VersionTuple &Introduced, SourceRange IntroducedRange,
2168
- const llvm::VersionTuple &Deprecated, SourceRange DeprecatedRange,
2169
- const llvm::VersionTuple &Obsoleted, SourceRange ObsoletedRange,
2170
- bool Implicit, bool IsSPI, bool IsForEmbedded)
2171
- : AvailableAttr(AtLoc, Range, Domain.getPlatformKind(), Message, Rename,
2172
- Introduced, IntroducedRange, Deprecated, DeprecatedRange,
2173
- Obsoleted, ObsoletedRange,
2174
- platformAgnosticFromDomainAndKind(Domain, Kind), Implicit,
2175
- IsSPI, IsForEmbedded) {}
2176
-
2177
2133
#undef INIT_VER_TUPLE
2178
2134
2179
2135
AvailableAttr *AvailableAttr::createUniversallyUnavailable (ASTContext &C,
@@ -2241,16 +2197,16 @@ bool BackDeployedAttr::isActivePlatform(const ASTContext &ctx,
2241
2197
}
2242
2198
2243
2199
AvailableAttr *AvailableAttr::clone (ASTContext &C, bool implicit) const {
2244
- return new (C) AvailableAttr (
2245
- implicit ? SourceLoc () : AtLoc, implicit ? SourceRange () : getRange (),
2246
- getPlatform (), Message, Rename,
2247
- Introduced ? *Introduced : llvm::VersionTuple (),
2248
- implicit ? SourceRange () : IntroducedRange,
2249
- Deprecated ? *Deprecated : llvm::VersionTuple (),
2250
- implicit ? SourceRange () : DeprecatedRange,
2251
- Obsoleted ? *Obsoleted : llvm::VersionTuple (),
2252
- implicit ? SourceRange () : ObsoletedRange,
2253
- getPlatformAgnosticAvailability (), implicit, isSPI (), isForEmbedded ());
2200
+ return new (C) AvailableAttr (implicit ? SourceLoc () : AtLoc,
2201
+ implicit ? SourceRange () : getRange (), Domain ,
2202
+ getKind (), Message, Rename,
2203
+ Introduced ? *Introduced : llvm::VersionTuple (),
2204
+ implicit ? SourceRange () : IntroducedRange,
2205
+ Deprecated ? *Deprecated : llvm::VersionTuple (),
2206
+ implicit ? SourceRange () : DeprecatedRange,
2207
+ Obsoleted ? *Obsoleted : llvm::VersionTuple (),
2208
+ implicit ? SourceRange () : ObsoletedRange,
2209
+ implicit, isSPI (), isForEmbedded ());
2254
2210
}
2255
2211
2256
2212
std::optional<OriginallyDefinedInAttr::ActiveVersion>
0 commit comments