@@ -196,45 +196,45 @@ class VersionRange {
196196
197197// / Represents a version range in which something is available.
198198// /
199- // / The AvailabilityContext structure forms a [lattice][], which allows it to
199+ // / The AvailabilityRange structure forms a [lattice][], which allows it to
200200// / have meaningful union and intersection operations ("join" and "meet"),
201201// / which use conservative approximations to prevent availability violations.
202202// / See #unionWith, #intersectWith, and #constrainWith.
203203// /
204204// / [lattice]: http://mathworld.wolfram.com/Lattice.html
205205// /
206206// / NOTE: Generally you should use the utilities on \c AvailabilityInference
207- // / to create an \c AvailabilityContext , rather than creating one directly.
208- class AvailabilityContext {
207+ // / to create an \c AvailabilityRange , rather than creating one directly.
208+ class AvailabilityRange {
209209 VersionRange Range;
210210
211211public:
212- explicit AvailabilityContext (VersionRange Range) : Range(Range) {}
212+ explicit AvailabilityRange (VersionRange Range) : Range(Range) {}
213213
214214 // / Creates a context that imposes the constraints of the ASTContext's
215215 // / deployment target.
216- static AvailabilityContext forDeploymentTarget (const ASTContext &Ctx);
216+ static AvailabilityRange forDeploymentTarget (const ASTContext &Ctx);
217217
218218 // / Creates a context that imposes the constraints of the ASTContext's
219219 // / inlining target (i.e. minimum inlining version).
220- static AvailabilityContext forInliningTarget (const ASTContext &Ctx);
220+ static AvailabilityRange forInliningTarget (const ASTContext &Ctx);
221221
222222 // / Creates a context that imposes the constraints of the ASTContext's
223223 // / minimum runtime version.
224- static AvailabilityContext forRuntimeTarget (const ASTContext &Ctx);
224+ static AvailabilityRange forRuntimeTarget (const ASTContext &Ctx);
225225
226226 // / Creates a context that imposes no constraints.
227227 // /
228228 // / \see isAlwaysAvailable
229- static AvailabilityContext alwaysAvailable () {
230- return AvailabilityContext (VersionRange::all ());
229+ static AvailabilityRange alwaysAvailable () {
230+ return AvailabilityRange (VersionRange::all ());
231231 }
232232
233233 // / Creates a context that can never actually occur.
234234 // /
235235 // / \see isKnownUnreachable
236- static AvailabilityContext neverAvailable () {
237- return AvailabilityContext (VersionRange::empty ());
236+ static AvailabilityRange neverAvailable () {
237+ return AvailabilityRange (VersionRange::empty ());
238238 }
239239
240240 // / Returns the range of possible versions required by this context.
@@ -245,7 +245,7 @@ class AvailabilityContext {
245245
246246 // / Returns the minimum version required by this context. This convenience
247247 // / is meant for debugging, diagnostics, serialization, etc. Use of the set
248- // / algebra operations on `AvailabilityContext ` should be preferred over
248+ // / algebra operations on `AvailabilityRange ` should be preferred over
249249 // / direct comparison of raw versions.
250250 // /
251251 // / Only call when `hasMinimumVersion()` returns true.
@@ -256,14 +256,14 @@ class AvailabilityContext {
256256 // / Returns true if \p other makes stronger guarantees than this context.
257257 // /
258258 // / That is, `a.isContainedIn(b)` implies `a.union(b) == b`.
259- bool isContainedIn (const AvailabilityContext &other) const {
259+ bool isContainedIn (const AvailabilityRange &other) const {
260260 return Range.isContainedIn (other.Range );
261261 }
262262
263263 // / Returns true if \p other is a strict subset of this context.
264264 // /
265265 // / That is, `a.isSupersetOf(b)` implies `a != b` and `a.union(b) == a`.
266- bool isSupersetOf (const AvailabilityContext &other) const {
266+ bool isSupersetOf (const AvailabilityRange &other) const {
267267 return Range.isSupersetOf (other.Range );
268268 }
269269
@@ -291,7 +291,7 @@ class AvailabilityContext {
291291 // /
292292 // / As an example, this is used when figuring out the required availability
293293 // / for a type that references multiple nominal decls.
294- void intersectWith (const AvailabilityContext &other) {
294+ void intersectWith (const AvailabilityRange &other) {
295295 Range.intersectWith (other.Range );
296296 }
297297
@@ -302,7 +302,7 @@ class AvailabilityContext {
302302 // / treating some invalid deployment environments as available.
303303 // /
304304 // / As an example, this is used for the true branch of `#available`.
305- void constrainWith (const AvailabilityContext &other) {
305+ void constrainWith (const AvailabilityRange &other) {
306306 Range.constrainWith (other.Range );
307307 }
308308
@@ -314,13 +314,13 @@ class AvailabilityContext {
314314 // /
315315 // / As an example, this is used for the else branch of a conditional with
316316 // / multiple `#available` checks.
317- void unionWith (const AvailabilityContext &other) {
317+ void unionWith (const AvailabilityRange &other) {
318318 Range.unionWith (other.Range );
319319 }
320320
321321 // / Returns a representation of this range as a string for debugging purposes.
322322 std::string getAsString () const {
323- return " AvailabilityContext (" + getVersionString () + " )" ;
323+ return " AvailabilityRange (" + getVersionString () + " )" ;
324324 }
325325
326326 // / Returns a representation of the raw version range as a string for
@@ -345,11 +345,11 @@ class AvailabilityInference {
345345 ArrayRef<const Decl *> InferredFromDecls,
346346 ASTContext &Context);
347347
348- static AvailabilityContext inferForType (Type t);
348+ static AvailabilityRange inferForType (Type t);
349349
350350 // / Returns the context where a declaration is available
351351 // / We assume a declaration without an annotation is always available.
352- static AvailabilityContext availableRange (const Decl *D, ASTContext &C);
352+ static AvailabilityRange availableRange (const Decl *D, ASTContext &C);
353353
354354 // / Returns true is the declaration is `@_spi_available`.
355355 static bool isAvailableAsSPI (const Decl *D, ASTContext &C);
@@ -358,8 +358,8 @@ class AvailabilityInference {
358358 // / @available attribute.
359359 // /
360360 // / NOTE: The attribute must be active on the current platform.
361- static AvailabilityContext availableRange (const AvailableAttr *attr,
362- ASTContext &C);
361+ static AvailabilityRange availableRange (const AvailableAttr *attr,
362+ ASTContext &C);
363363
364364 // / Returns the attribute that should be used to determine the availability
365365 // / range of the given declaration, or nullptr if there is none.
@@ -369,10 +369,10 @@ class AvailabilityInference {
369369 // / Returns the context for which the declaration
370370 // / is annotated as available, or None if the declaration
371371 // / has no availability annotation.
372- static std::optional<AvailabilityContext >
372+ static std::optional<AvailabilityRange >
373373 annotatedAvailableRange (const Decl *D, ASTContext &C);
374374
375- static AvailabilityContext
375+ static AvailabilityRange
376376 annotatedAvailableRangeForAttr (const SpecializeAttr *attr, ASTContext &ctx);
377377
378378 // / For the attribute's introduction version, update the platform and version
0 commit comments