@@ -196,45 +196,45 @@ class VersionRange {
196
196
197
197
// / Represents a version range in which something is available.
198
198
// /
199
- // / The AvailabilityContext structure forms a [lattice][], which allows it to
199
+ // / The AvailabilityRange structure forms a [lattice][], which allows it to
200
200
// / have meaningful union and intersection operations ("join" and "meet"),
201
201
// / which use conservative approximations to prevent availability violations.
202
202
// / See #unionWith, #intersectWith, and #constrainWith.
203
203
// /
204
204
// / [lattice]: http://mathworld.wolfram.com/Lattice.html
205
205
// /
206
206
// / 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 {
209
209
VersionRange Range;
210
210
211
211
public:
212
- explicit AvailabilityContext (VersionRange Range) : Range(Range) {}
212
+ explicit AvailabilityRange (VersionRange Range) : Range(Range) {}
213
213
214
214
// / Creates a context that imposes the constraints of the ASTContext's
215
215
// / deployment target.
216
- static AvailabilityContext forDeploymentTarget (const ASTContext &Ctx);
216
+ static AvailabilityRange forDeploymentTarget (const ASTContext &Ctx);
217
217
218
218
// / Creates a context that imposes the constraints of the ASTContext's
219
219
// / inlining target (i.e. minimum inlining version).
220
- static AvailabilityContext forInliningTarget (const ASTContext &Ctx);
220
+ static AvailabilityRange forInliningTarget (const ASTContext &Ctx);
221
221
222
222
// / Creates a context that imposes the constraints of the ASTContext's
223
223
// / minimum runtime version.
224
- static AvailabilityContext forRuntimeTarget (const ASTContext &Ctx);
224
+ static AvailabilityRange forRuntimeTarget (const ASTContext &Ctx);
225
225
226
226
// / Creates a context that imposes no constraints.
227
227
// /
228
228
// / \see isAlwaysAvailable
229
- static AvailabilityContext alwaysAvailable () {
230
- return AvailabilityContext (VersionRange::all ());
229
+ static AvailabilityRange alwaysAvailable () {
230
+ return AvailabilityRange (VersionRange::all ());
231
231
}
232
232
233
233
// / Creates a context that can never actually occur.
234
234
// /
235
235
// / \see isKnownUnreachable
236
- static AvailabilityContext neverAvailable () {
237
- return AvailabilityContext (VersionRange::empty ());
236
+ static AvailabilityRange neverAvailable () {
237
+ return AvailabilityRange (VersionRange::empty ());
238
238
}
239
239
240
240
// / Returns the range of possible versions required by this context.
@@ -245,7 +245,7 @@ class AvailabilityContext {
245
245
246
246
// / Returns the minimum version required by this context. This convenience
247
247
// / 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
249
249
// / direct comparison of raw versions.
250
250
// /
251
251
// / Only call when `hasMinimumVersion()` returns true.
@@ -256,14 +256,14 @@ class AvailabilityContext {
256
256
// / Returns true if \p other makes stronger guarantees than this context.
257
257
// /
258
258
// / That is, `a.isContainedIn(b)` implies `a.union(b) == b`.
259
- bool isContainedIn (const AvailabilityContext &other) const {
259
+ bool isContainedIn (const AvailabilityRange &other) const {
260
260
return Range.isContainedIn (other.Range );
261
261
}
262
262
263
263
// / Returns true if \p other is a strict subset of this context.
264
264
// /
265
265
// / 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 {
267
267
return Range.isSupersetOf (other.Range );
268
268
}
269
269
@@ -291,7 +291,7 @@ class AvailabilityContext {
291
291
// /
292
292
// / As an example, this is used when figuring out the required availability
293
293
// / for a type that references multiple nominal decls.
294
- void intersectWith (const AvailabilityContext &other) {
294
+ void intersectWith (const AvailabilityRange &other) {
295
295
Range.intersectWith (other.Range );
296
296
}
297
297
@@ -302,7 +302,7 @@ class AvailabilityContext {
302
302
// / treating some invalid deployment environments as available.
303
303
// /
304
304
// / As an example, this is used for the true branch of `#available`.
305
- void constrainWith (const AvailabilityContext &other) {
305
+ void constrainWith (const AvailabilityRange &other) {
306
306
Range.constrainWith (other.Range );
307
307
}
308
308
@@ -314,13 +314,13 @@ class AvailabilityContext {
314
314
// /
315
315
// / As an example, this is used for the else branch of a conditional with
316
316
// / multiple `#available` checks.
317
- void unionWith (const AvailabilityContext &other) {
317
+ void unionWith (const AvailabilityRange &other) {
318
318
Range.unionWith (other.Range );
319
319
}
320
320
321
321
// / Returns a representation of this range as a string for debugging purposes.
322
322
std::string getAsString () const {
323
- return " AvailabilityContext (" + getVersionString () + " )" ;
323
+ return " AvailabilityRange (" + getVersionString () + " )" ;
324
324
}
325
325
326
326
// / Returns a representation of the raw version range as a string for
@@ -345,11 +345,11 @@ class AvailabilityInference {
345
345
ArrayRef<const Decl *> InferredFromDecls,
346
346
ASTContext &Context);
347
347
348
- static AvailabilityContext inferForType (Type t);
348
+ static AvailabilityRange inferForType (Type t);
349
349
350
350
// / Returns the context where a declaration is available
351
351
// / 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);
353
353
354
354
// / Returns true is the declaration is `@_spi_available`.
355
355
static bool isAvailableAsSPI (const Decl *D, ASTContext &C);
@@ -358,8 +358,8 @@ class AvailabilityInference {
358
358
// / @available attribute.
359
359
// /
360
360
// / 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);
363
363
364
364
// / Returns the attribute that should be used to determine the availability
365
365
// / range of the given declaration, or nullptr if there is none.
@@ -369,10 +369,10 @@ class AvailabilityInference {
369
369
// / Returns the context for which the declaration
370
370
// / is annotated as available, or None if the declaration
371
371
// / has no availability annotation.
372
- static std::optional<AvailabilityContext >
372
+ static std::optional<AvailabilityRange >
373
373
annotatedAvailableRange (const Decl *D, ASTContext &C);
374
374
375
- static AvailabilityContext
375
+ static AvailabilityRange
376
376
annotatedAvailableRangeForAttr (const SpecializeAttr *attr, ASTContext &ctx);
377
377
378
378
// / For the attribute's introduction version, update the platform and version
0 commit comments