mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Module aliasing: Use real module names with -scan-dependencies
Resolves rdar://85991587
This commit is contained in:
@@ -1685,6 +1685,7 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
|
||||
if (subInstance.setup(subInvocation)) {
|
||||
return std::make_error_code(std::errc::not_supported);
|
||||
}
|
||||
|
||||
info.BuildArguments = BuildArgs;
|
||||
info.Hash = CacheHash;
|
||||
auto target = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(), "-target") - 1);
|
||||
@@ -1826,7 +1827,12 @@ std::error_code ExplicitSwiftModuleLoader::findModuleFilesInDirectory(
|
||||
|
||||
bool ExplicitSwiftModuleLoader::canImportModule(
|
||||
ImportPath::Element mID, llvm::VersionTuple version, bool underlyingVersion) {
|
||||
StringRef moduleName = mID.Item.str();
|
||||
// Look up the module with the real name (physical name on disk);
|
||||
// in case `-module-alias` is used, the name appearing in source files
|
||||
// and the real module name are different. For example, '-module-alias Foo=Bar'
|
||||
// maps Foo appearing in source files, e.g. 'import Foo', to the real module
|
||||
// name Bar (on-disk name), which should be searched for loading.
|
||||
StringRef moduleName = Ctx.getRealModuleName(mID.Item).str();
|
||||
auto it = Impl.ExplicitModuleMap.find(moduleName);
|
||||
// If no provided explicit module matches the name, then it cannot be imported.
|
||||
if (it == Impl.ExplicitModuleMap.end()) {
|
||||
|
||||
Reference in New Issue
Block a user