mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Only treat @backDeployed functions as fragile on platforms with an active attribute.
Previously, typechecking and SILGen would treat a function body as fragile as long as the declaration had a `@backDeployed` attribute, regardless of the platform specified by the attribute. This was overly conservative since back deployed functions are only emitted into the client on specific platforms. Now a `@backDeployed` function can reference non-`public` declarations on the platforms it is resilient on:
```
@backDeployed(before: iOS 15)
public func foo() {
#if os(iOS)
// Fragile; this code may be emitted into the client.
#else
// Resilient; this code won't ever be exposed to clients.
#endif
}
```
Resolves rdar://105298520
This commit is contained in:
@@ -955,7 +955,7 @@ bool SILDeclRef::isBackDeployed() const {
|
||||
|
||||
auto *decl = getDecl();
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(decl))
|
||||
return afd->isBackDeployed();
|
||||
return afd->isBackDeployed(getASTContext());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user