mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'upstream/main' into rebranch
This commit is contained in:
@@ -1442,8 +1442,6 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
|
||||
genericSubInvocation.getFrontendOptions().DisableImplicitModules = true;
|
||||
GenericArgs.push_back("-disable-implicit-swift-modules");
|
||||
}
|
||||
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModules =
|
||||
searchPathOpts.ExplicitSwiftModules;
|
||||
// Pass down -explicit-swift-module-map-file
|
||||
// FIXME: we shouldn't need this. Remove it?
|
||||
StringRef explictSwiftModuleMap = searchPathOpts.ExplicitSwiftModuleMap;
|
||||
@@ -1722,15 +1720,10 @@ bool ExplicitSwiftModuleLoader::findModule(ImportPath::Element ModuleID,
|
||||
return false;
|
||||
}
|
||||
auto &moduleInfo = it->getValue();
|
||||
if (moduleInfo.moduleBuffer) {
|
||||
// We found an explicit module matches the given name, give the buffer
|
||||
// back to the caller side.
|
||||
*ModuleBuffer = std::move(moduleInfo.moduleBuffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set IsFramework bit according to the moduleInfo
|
||||
IsFramework = moduleInfo.isFramework;
|
||||
IsSystemModule = moduleInfo.isSystem;
|
||||
|
||||
auto &fs = *Ctx.SourceMgr.getFileSystem();
|
||||
// Open .swiftmodule file
|
||||
@@ -1816,7 +1809,6 @@ void ExplicitSwiftModuleLoader::collectVisibleTopLevelModuleNames(
|
||||
std::unique_ptr<ExplicitSwiftModuleLoader>
|
||||
ExplicitSwiftModuleLoader::create(ASTContext &ctx,
|
||||
DependencyTracker *tracker, ModuleLoadingMode loadMode,
|
||||
ArrayRef<std::string> ExplicitModulePaths,
|
||||
StringRef ExplicitSwiftModuleMap,
|
||||
bool IgnoreSwiftSourceInfoFile) {
|
||||
auto result = std::unique_ptr<ExplicitSwiftModuleLoader>(
|
||||
@@ -1828,24 +1820,6 @@ ExplicitSwiftModuleLoader::create(ASTContext &ctx,
|
||||
// Parse a JSON file to collect explicitly built modules.
|
||||
Impl.parseSwiftExplicitModuleMap(ExplicitSwiftModuleMap);
|
||||
}
|
||||
// Collect .swiftmodule paths from -swift-module-path
|
||||
// FIXME: remove these.
|
||||
for (auto path: ExplicitModulePaths) {
|
||||
std::string name;
|
||||
// Load the explicit module into a buffer and get its name.
|
||||
std::unique_ptr<llvm::MemoryBuffer> buffer = getModuleName(ctx, path, name);
|
||||
if (buffer) {
|
||||
// Register this module for future loading.
|
||||
auto &entry = Impl.ExplicitModuleMap[name];
|
||||
entry.modulePath = path;
|
||||
entry.moduleBuffer = std::move(buffer);
|
||||
} else {
|
||||
// We cannot read the module content, diagnose.
|
||||
ctx.Diags.diagnose(SourceLoc(),
|
||||
diag::error_opening_explicit_module_file,
|
||||
path);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user