Invoke Explicit Interface Build when '-explicit-interface-module-build' is specified on a '-compile-module-from-interface' frontend action, using the CompilerInstance instantiated directly from the command-line in order to build the module.

This commit is contained in:
Artem Chikin
2022-08-05 07:41:34 -07:00
parent a90d3e2de1
commit aee45799b8
3 changed files with 21 additions and 12 deletions

View File

@@ -422,17 +422,26 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
StringRef PrebuiltCachePath = FEOpts.PrebuiltModuleCachePath;
ModuleInterfaceLoaderOptions LoaderOpts(FEOpts);
StringRef ABIPath = Instance.getPrimarySpecificPathsForAtMostOnePrimary()
.SupplementaryOutputs.ABIDescriptorOutputPath;
return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
.SupplementaryOutputs.ABIDescriptorOutputPath;
// If an explicit interface build was requested, bypass the creation of a new
// sub-instance from the interface which will build it in a separate thread,
// and isntead directly use the current \c Instance for compilation.
if (FEOpts.ExplicitInterfaceBuild)
return ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
Instance, Invocation.getClangModuleCachePath(),
FEOpts.BackupModuleInterfaceDir, PrebuiltCachePath, ABIPath, InputPath,
Invocation.getOutputFilename(),
FEOpts.SerializeModuleInterfaceDependencyHashes,
Invocation.getSearchPathOptions().CandidateCompiledModules);
else
return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
Instance.getSourceMgr(), Instance.getDiags(),
Invocation.getSearchPathOptions(), Invocation.getLangOptions(),
Invocation.getClangImporterOptions(),
Invocation.getClangModuleCachePath(), PrebuiltCachePath,
FEOpts.BackupModuleInterfaceDir,
Invocation.getModuleName(), InputPath, Invocation.getOutputFilename(), ABIPath,
FEOpts.BackupModuleInterfaceDir, Invocation.getModuleName(), InputPath,
Invocation.getOutputFilename(), ABIPath,
FEOpts.SerializeModuleInterfaceDependencyHashes,
FEOpts.shouldTrackSystemDependencies(), LoaderOpts,
RequireOSSAModules_t(Invocation.getSILOptions()));