mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleInterface] Don't alias the import if it was skipped
This commit is contained in:
@@ -212,7 +212,9 @@ static void diagnoseScopedImports(DiagnosticEngine &diags,
|
||||
/// source declarations.
|
||||
static void printImports(raw_ostream &out,
|
||||
ModuleInterfaceOptions const &Opts,
|
||||
ModuleDecl *M) {
|
||||
ModuleDecl *M,
|
||||
const llvm::SmallSet<StringRef, 4>
|
||||
&AliasModuleNamesTargets) {
|
||||
// FIXME: This is very similar to what's in Serializer::writeInputBlock, but
|
||||
// it's not obvious what higher-level optimization would be factored out here.
|
||||
ModuleDecl::ImportFilter allImportFilter = {
|
||||
@@ -322,7 +324,8 @@ static void printImports(raw_ostream &out,
|
||||
}
|
||||
|
||||
out << "import ";
|
||||
if (Opts.AliasModuleNames)
|
||||
if (Opts.AliasModuleNames &&
|
||||
AliasModuleNamesTargets.contains(importedModule->getName().str()))
|
||||
out << MODULE_DISAMBIGUATING_PREFIX;
|
||||
importedModule->getReverseFullModuleName().printForward(out);
|
||||
|
||||
@@ -786,7 +789,7 @@ bool swift::emitSwiftInterface(raw_ostream &out,
|
||||
llvm::SmallSet<StringRef, 4> aliasModuleNamesTargets;
|
||||
printToolVersionAndFlagsComment(out, Opts, M, aliasModuleNamesTargets);
|
||||
|
||||
printImports(out, Opts, M);
|
||||
printImports(out, Opts, M, aliasModuleNamesTargets);
|
||||
|
||||
static bool forceUseExportedModuleNameInPublicOnly =
|
||||
getenv("SWIFT_DEBUG_USE_EXPORTED_MODULE_NAME_IN_PUBLIC_ONLY");
|
||||
|
||||
Reference in New Issue
Block a user