mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Sema] @_exported imports export @_spi decls too
Enable transitive imports of all SPI groups through @_exported imports.
This brings to SPI the same behavior that we have for API.
```
// Module A
@_spi(S) public func foo() {}
// Module B
@_exported import A
// Module C
@_spi(S) import B
foo() // SPI imported through the reexport of A from B
```
rdar://101566534
This commit is contained in:
@@ -1488,11 +1488,13 @@ void SerializedASTFile::lookupImportedSPIGroups(
|
||||
const ModuleDecl *importedModule,
|
||||
llvm::SmallSetVector<Identifier, 4> &spiGroups) const {
|
||||
auto M = getParentModule();
|
||||
auto &imports = M->getASTContext().getImportCache();
|
||||
for (auto &dep : File.Dependencies) {
|
||||
if (!dep.Import.hasValue())
|
||||
continue;
|
||||
|
||||
if (dep.Import->importedModule == importedModule) {
|
||||
if (dep.Import->importedModule == importedModule ||
|
||||
imports.isImportedBy(importedModule, dep.Import->importedModule)) {
|
||||
spiGroups.insert(dep.spiGroups.begin(), dep.spiGroups.end());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user