mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CoroutineAccessors] Only reference when available
Don't bind references to storage to use (new ABI) coroutine accessors unless they're guaranteed to be available. For example, when building against a resilient module that has coroutine accessors, they can only be used if the deployment target is >= the version of Swift that includes the feature. rdar://148783895
This commit is contained in:
@@ -3323,11 +3323,13 @@ static bool isBorrowableSubject(SILGenFunction &SGF,
|
||||
if (!storage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
auto pair = std::make_pair<>(subjectExpr->getSourceRange(), SGF.FunctionDC);
|
||||
|
||||
// Check the access strategy used to read the storage.
|
||||
auto strategy =
|
||||
storage->getAccessStrategy(access, AccessKind::Read, SGF.SGM.SwiftModule,
|
||||
SGF.F.getResilienceExpansion(),
|
||||
SGF.F.getResilienceExpansion(), pair,
|
||||
/*useOldABI=*/false);
|
||||
|
||||
switch (strategy.getKind()) {
|
||||
|
||||
Reference in New Issue
Block a user