@@ -228,14 +228,14 @@ static SILValue emitZipperedBackDeployIfAvailableBooleanTestValue(
228228 assert (ctx.LangOpts .TargetVariant );
229229
230230 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 ( );
233233 }
234234
235235 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 ( );
239239 }
240240
241241 return emitZipperedOSVersionRangeCheck (SGF, loc, OSVersion, VariantOSVersion);
@@ -254,25 +254,26 @@ static void emitBackDeployIfAvailableCondition(SILGenFunction &SGF,
254254 SILLocation loc,
255255 SILBasicBlock *availableBB,
256256 SILBasicBlock *unavailableBB) {
257- if (SGF.getASTContext ().LangOpts .TargetVariant ) {
257+ auto &ctx = SGF.getASTContext ();
258+ if (ctx.LangOpts .TargetVariant ) {
258259 SILValue booleanTestValue =
259260 emitZipperedBackDeployIfAvailableBooleanTestValue (
260261 SGF, AFD, loc, availableBB, unavailableBB);
261262 SGF.B .createCondBranch (loc, booleanTestValue, availableBB, unavailableBB);
262263 return ;
263264 }
264265
265- auto version = AFD->getBackDeployedBeforeOSVersion (SGF. SGM . getASTContext () );
266+ auto attrAndRange = AFD->getBackDeployedAttrAndRange (ctx );
266267 VersionRange OSVersion = VersionRange::empty ();
267- if (version. has_value () ) {
268- OSVersion = VersionRange::allGTE (*version );
268+ if (attrAndRange ) {
269+ OSVersion = attrAndRange-> second . getRawVersionRange ( );
269270 }
270271
271272 SILValue booleanTestValue;
272273 if (OSVersion.isEmpty () || OSVersion.isAll ()) {
273274 // If there's no check for the current platform, this condition is
274275 // trivially true.
275- SILType i1 = SILType::getBuiltinIntegerType (1 , SGF. getASTContext () );
276+ SILType i1 = SILType::getBuiltinIntegerType (1 , ctx );
276277 booleanTestValue = SGF.B .createIntegerLiteral (loc, i1, 1 );
277278 } else {
278279 bool isMacCatalyst =
@@ -434,8 +435,8 @@ SILGenFunction::emitIfAvailableQuery(SILLocation loc,
434435bool SILGenModule::requiresBackDeploymentThunk (ValueDecl *decl,
435436 ResilienceExpansion expansion) {
436437 auto &ctx = getASTContext ();
437- auto backDeployBeforeVersion = decl->getBackDeployedBeforeOSVersion (ctx);
438- if (!backDeployBeforeVersion )
438+ auto attrAndRange = decl->getBackDeployedAttrAndRange (ctx);
439+ if (!attrAndRange )
439440 return false ;
440441
441442 switch (expansion) {
@@ -453,8 +454,7 @@ bool SILGenModule::requiresBackDeploymentThunk(ValueDecl *decl,
453454 // high enough that the ABI implementation of the back deployed declaration is
454455 // guaranteed to be available.
455456 auto deploymentAvailability = AvailabilityRange::forDeploymentTarget (ctx);
456- auto declAvailability = AvailabilityRange (*backDeployBeforeVersion);
457- if (deploymentAvailability.isContainedIn (declAvailability))
457+ if (deploymentAvailability.isContainedIn (attrAndRange->second ))
458458 return false ;
459459
460460 return true ;
0 commit comments