mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: Print imports with @preconcurrency in swiftinterface files.
When a module has been imported `@preconcurrency` in source, when it is printed in a `swiftinterface` file it should be printed along with the attribute to ensure that type checking of the module's public declarations behaves consistently. This fix is a little unsatisfying because it adds another a linear scan over all imports in the source for each printed import. This should be improved, but it can be done later. Resolves rdar://136857313.
This commit is contained in:
@@ -271,6 +271,9 @@ static void printImports(raw_ostream &out,
|
||||
ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::ShadowedByCrossImportOverlay};
|
||||
|
||||
// FIXME: Scan over all imports in the module once to build up the attribute
|
||||
// set for printed imports, instead of repeatedly doing linear scans for each
|
||||
// kind of attribute.
|
||||
using ImportSet = llvm::SmallSet<ImportedModule, 8, ImportedModule::Order>;
|
||||
auto getImports = [M](ModuleDecl::ImportFilter filter) -> ImportSet {
|
||||
SmallVector<ImportedModule, 8> matchingImports;
|
||||
@@ -355,6 +358,9 @@ static void printImports(raw_ostream &out,
|
||||
out << "@_spi(" << spiName << ") ";
|
||||
}
|
||||
|
||||
if (M->isModuleImportedPreconcurrency(importedModule))
|
||||
out << "@preconcurrency ";
|
||||
|
||||
if (Opts.printPackageInterface() &&
|
||||
!publicImportSet.count(import) &&
|
||||
packageOnlyImportSet.count(import))
|
||||
|
||||
Reference in New Issue
Block a user