mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Restrict reexported SPIs to modules with an export_as relationship
@_exported exports SPIs only when the exported module defines export_as pointing to the exporter module. Other reexports do not reexport SPIs. This is to prevent SPI reexporting to get out of hands with the wide reexports of the Objective-C world. rdar://102335473
This commit is contained in:
@@ -2861,7 +2861,8 @@ void SourceFile::lookupImportedSPIGroups(
|
||||
for (auto &import : *Imports) {
|
||||
if (import.options.contains(ImportFlags::SPIAccessControl) &&
|
||||
(importedModule == import.module.importedModule ||
|
||||
imports.isImportedBy(importedModule, import.module.importedModule))) {
|
||||
(imports.isImportedBy(importedModule, import.module.importedModule) &&
|
||||
importedModule->isExportedAs(import.module.importedModule)))) {
|
||||
spiGroups.insert(import.spiGroups.begin(), import.spiGroups.end());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user