@@ -228,14 +228,14 @@ static SILValue emitZipperedBackDeployIfAvailableBooleanTestValue(
228
228
assert (ctx.LangOpts .TargetVariant );
229
229
230
230
VersionRange OSVersion = VersionRange::all ();
231
- if (auto version = AFD->getBackDeployedBeforeOSVersion (ctx)) {
232
- OSVersion = VersionRange::allGTE (*version );
231
+ if (auto attrAndRange = AFD->getBackDeployedAttrAndRange (ctx)) {
232
+ OSVersion = attrAndRange-> second . getRawVersionRange ( );
233
233
}
234
234
235
235
VersionRange VariantOSVersion = VersionRange::all ();
236
- if (auto version =
237
- AFD->getBackDeployedBeforeOSVersion (ctx, /* forTargetVariant=*/ true )) {
238
- VariantOSVersion = VersionRange::allGTE (*version );
236
+ if (auto attrAndRange =
237
+ AFD->getBackDeployedAttrAndRange (ctx, /* forTargetVariant=*/ true )) {
238
+ VariantOSVersion = attrAndRange-> second . getRawVersionRange ( );
239
239
}
240
240
241
241
return emitZipperedOSVersionRangeCheck (SGF, loc, OSVersion, VariantOSVersion);
@@ -254,25 +254,26 @@ static void emitBackDeployIfAvailableCondition(SILGenFunction &SGF,
254
254
SILLocation loc,
255
255
SILBasicBlock *availableBB,
256
256
SILBasicBlock *unavailableBB) {
257
- if (SGF.getASTContext ().LangOpts .TargetVariant ) {
257
+ auto &ctx = SGF.getASTContext ();
258
+ if (ctx.LangOpts .TargetVariant ) {
258
259
SILValue booleanTestValue =
259
260
emitZipperedBackDeployIfAvailableBooleanTestValue (
260
261
SGF, AFD, loc, availableBB, unavailableBB);
261
262
SGF.B .createCondBranch (loc, booleanTestValue, availableBB, unavailableBB);
262
263
return ;
263
264
}
264
265
265
- auto version = AFD->getBackDeployedBeforeOSVersion (SGF. SGM . getASTContext () );
266
+ auto attrAndRange = AFD->getBackDeployedAttrAndRange (ctx );
266
267
VersionRange OSVersion = VersionRange::empty ();
267
- if (version. has_value () ) {
268
- OSVersion = VersionRange::allGTE (*version );
268
+ if (attrAndRange ) {
269
+ OSVersion = attrAndRange-> second . getRawVersionRange ( );
269
270
}
270
271
271
272
SILValue booleanTestValue;
272
273
if (OSVersion.isEmpty () || OSVersion.isAll ()) {
273
274
// If there's no check for the current platform, this condition is
274
275
// trivially true.
275
- SILType i1 = SILType::getBuiltinIntegerType (1 , SGF. getASTContext () );
276
+ SILType i1 = SILType::getBuiltinIntegerType (1 , ctx );
276
277
booleanTestValue = SGF.B .createIntegerLiteral (loc, i1, 1 );
277
278
} else {
278
279
bool isMacCatalyst =
@@ -434,8 +435,8 @@ SILGenFunction::emitIfAvailableQuery(SILLocation loc,
434
435
bool SILGenModule::requiresBackDeploymentThunk (ValueDecl *decl,
435
436
ResilienceExpansion expansion) {
436
437
auto &ctx = getASTContext ();
437
- auto backDeployBeforeVersion = decl->getBackDeployedBeforeOSVersion (ctx);
438
- if (!backDeployBeforeVersion )
438
+ auto attrAndRange = decl->getBackDeployedAttrAndRange (ctx);
439
+ if (!attrAndRange )
439
440
return false ;
440
441
441
442
switch (expansion) {
@@ -453,8 +454,7 @@ bool SILGenModule::requiresBackDeploymentThunk(ValueDecl *decl,
453
454
// high enough that the ABI implementation of the back deployed declaration is
454
455
// guaranteed to be available.
455
456
auto deploymentAvailability = AvailabilityRange::forDeploymentTarget (ctx);
456
- auto declAvailability = AvailabilityRange (*backDeployBeforeVersion);
457
- if (deploymentAvailability.isContainedIn (declAvailability))
457
+ if (deploymentAvailability.isContainedIn (attrAndRange->second ))
458
458
return false ;
459
459
460
460
return true ;
0 commit comments