File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -44,19 +44,28 @@ class AvailabilityContext {
4444
4545 AvailabilityContext (const Storage *info) : Info(info) { assert (info); };
4646
47- // / Retrieves a uniqued `AvailabilityContext` with the given platform
48- // / availability parameters.
47+ // / Retrieves an `AvailabilityContext` with the given platform availability
48+ // / parameters.
4949 static AvailabilityContext
5050 get (const AvailabilityRange &platformAvailability,
5151 std::optional<PlatformKind> unavailablePlatform, bool deprecated,
5252 ASTContext &ctx);
5353
5454public:
55+ // / Retrieves an `AvailabilityContext` constrained by the given platform
56+ // / availability range.
57+ static AvailabilityContext forPlatformRange (const AvailabilityRange &range,
58+ ASTContext &ctx);
59+
5560 // / Retrieves the maximally available `AvailabilityContext` for the
5661 // / compilation. The platform availability range will be set to the minimum
5762 // / inlining target (which may just be the deployment target).
5863 static AvailabilityContext forInliningTarget (ASTContext &ctx);
5964
65+ // / Retrieves an `AvailabilityContext` with the platform availability range
66+ // / set to the deployment target.
67+ static AvailabilityContext forDeploymentTarget (ASTContext &ctx);
68+
6069 // / Returns the range of platform versions which may execute code in the
6170 // / availability context, starting at its introduction version.
6271 AvailabilityRange getPlatformRange () const ;
Original file line number Diff line number Diff line change @@ -124,15 +124,26 @@ void AvailabilityContext::Storage::Profile(llvm::FoldingSetNodeID &id) const {
124124 Platform.Profile (id);
125125}
126126
127- AvailabilityContext AvailabilityContext::forInliningTarget (ASTContext &ctx) {
128- PlatformInfo platformInfo{AvailabilityRange::forInliningTarget (ctx),
129- PlatformKind::none,
127+ AvailabilityContext
128+ AvailabilityContext::forPlatformRange (const AvailabilityRange &range,
129+ ASTContext &ctx) {
130+ PlatformInfo platformInfo{range, PlatformKind::none,
130131 /* IsUnavailable*/ false ,
131132 /* IsUnavailableInEmbedded*/ false ,
132133 /* IsDeprecated*/ false };
133134 return AvailabilityContext (Storage::get (platformInfo, ctx));
134135}
135136
137+ AvailabilityContext AvailabilityContext::forInliningTarget (ASTContext &ctx) {
138+ return AvailabilityContext::forPlatformRange (
139+ AvailabilityRange::forInliningTarget (ctx), ctx);
140+ }
141+
142+ AvailabilityContext AvailabilityContext::forDeploymentTarget (ASTContext &ctx) {
143+ return AvailabilityContext::forPlatformRange (
144+ AvailabilityRange::forDeploymentTarget (ctx), ctx);
145+ }
146+
136147AvailabilityContext
137148AvailabilityContext::get (const AvailabilityRange &platformAvailability,
138149 std::optional<PlatformKind> unavailablePlatform,
You can’t perform that action at this time.
0 commit comments