Skip to content

Frontend: remove -swift-module-file. NFC #38710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/swift/AST/SearchPathOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ class SearchPathOptions {
/// would for a non-system header.
bool DisableModulesValidateSystemDependencies = false;

/// The paths to a set of explicitly built modules from interfaces.
std::vector<std::string> ExplicitSwiftModules;

/// A set of compiled modules that may be ready to use.
std::vector<std::string> CandidateCompiledModules;

Expand Down
3 changes: 0 additions & 3 deletions include/swift/Frontend/ModuleInterfaceLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class ExplicitSwiftModuleLoader: public SerializedModuleLoaderBase {
static std::unique_ptr<ExplicitSwiftModuleLoader>
create(ASTContext &ctx,
DependencyTracker *tracker, ModuleLoadingMode loadMode,
ArrayRef<std::string> ExplicitModulePaths,
StringRef ExplicitSwiftModuleMap,
bool IgnoreSwiftSourceInfoFile);

Expand All @@ -180,8 +179,6 @@ struct ExplicitModuleInfo {
std::string moduleDocPath;
// Path of the .swiftsourceinfo file.
std::string moduleSourceInfoPath;
// Opened buffer for the .swiftmodule file.
std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
// A flag that indicates whether this module is a framework
bool isFramework;
};
Expand Down
4 changes: 0 additions & 4 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ def disable_typo_correction : Flag<["-"], "disable-typo-correction">,
def disable_implicit_swift_modules: Flag<["-"], "disable-implicit-swift-modules">,
HelpText<"Disable building Swift modules implicitly by the compiler">;

def swift_module_file
: Separate<["-"], "swift-module-file">, MetaVarName<"<path>">,
HelpText<"Specify Swift module explicitly built from textual interface">;

def explict_swift_module_map
: Separate<["-"], "explicit-swift-module-map-file">, MetaVarName<"<path>">,
HelpText<"Specify a JSON file containing information of explict Swift modules">;
Expand Down
3 changes: 0 additions & 3 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,9 +1098,6 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts,
Opts.DisableModulesValidateSystemDependencies |=
Args.hasArg(OPT_disable_modules_validate_system_headers);

for (auto A: Args.filtered(OPT_swift_module_file)) {
Opts.ExplicitSwiftModules.push_back(resolveSearchPath(A->getValue()));
}
if (const Arg *A = Args.getLastArg(OPT_explict_swift_module_map))
Opts.ExplicitSwiftModuleMap = A->getValue();
for (auto A: Args.filtered(OPT_candidate_module_file)) {
Expand Down
1 change: 0 additions & 1 deletion lib/Frontend/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ bool CompilerInstance::setUpModuleLoaders() {
auto ESML = ExplicitSwiftModuleLoader::create(
*Context,
getDependencyTracker(), MLM,
Invocation.getSearchPathOptions().ExplicitSwiftModules,
Invocation.getSearchPathOptions().ExplicitSwiftModuleMap,
IgnoreSourceInfoFile);
this->DefaultSerializedLoader = ESML.get();
Expand Down
27 changes: 0 additions & 27 deletions lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,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;
Expand Down Expand Up @@ -1721,12 +1719,6 @@ 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;
Expand Down Expand Up @@ -1815,7 +1807,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>(
Expand All @@ -1827,24 +1818,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;
}
3 changes: 0 additions & 3 deletions lib/Serialization/ModuleDependencyScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ std::error_code PlaceholderSwiftModuleScanner::findModuleFilesInDirectory(
return std::make_error_code(std::errc::not_supported);
}
auto &moduleInfo = it->getValue();
assert(!moduleInfo.moduleBuffer &&
"Placeholder dependency module stubs cannot have an associated buffer");

auto dependencies = ModuleDependencies::forPlaceholderSwiftModuleStub(
moduleInfo.modulePath, moduleInfo.moduleDocPath,
moduleInfo.moduleSourceInfoPath);
Expand Down