Frontend: add a front-end option to specify module names for which we prefer to loading via interfaces

ABI checker imports Swift frameworks by using Swift interfaces for various
reasons. The existing way of controlling preferred importing mechanism is by
setting an environment variable (SWIFT_FORCE_MODULE_LOADING), which may lead
to performance issues because the stdlib could also be loaded in this way.

This patch adds a new front-end option to specify module names for
which we prefer to importing via Swift interface. The option currently is only
accessible via swift-api-digester.

rdar://54559888
This commit is contained in:
Xi Ge
2019-08-27 17:39:15 -07:00
parent e9d22f25f7
commit 1e656662d9
9 changed files with 64 additions and 7 deletions

View File

@@ -1435,11 +1435,14 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory(
}
// Create an instance of the Impl to do the heavy lifting.
auto ModuleName = ModuleID.first.str();
ParseableInterfaceModuleLoaderImpl Impl(
Ctx, ModPath, InPath, ModuleID.first.str(),
Ctx, ModPath, InPath, ModuleName,
CacheDir, PrebuiltCacheDir, ModuleID.second,
RemarkOnRebuildFromInterface, dependencyTracker,
LoadMode);
llvm::is_contained(PreferInterfaceForModules,
ModuleName)?
ModuleLoadingMode::PreferParseable : LoadMode);
// Ask the impl to find us a module that we can load or give us an error
// telling us that we couldn't load it.