mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Frontend] Intro global control to force loading from swiftinterface
Intro ASTContext::setIgnoreAdjacentModules to change module loading to accept load only resilient modules from their swiftinterfaces, ignoring the adjacent module and any silencing swiftinterfaces errors.
This commit is contained in:
@@ -677,7 +677,7 @@ class ModuleInterfaceLoaderImpl {
|
||||
std::pair<std::string, std::string> getCompiledModuleCandidates() {
|
||||
std::pair<std::string, std::string> result;
|
||||
// Should we attempt to load a swiftmodule adjacent to the swiftinterface?
|
||||
bool shouldLoadAdjacentModule = true;
|
||||
bool shouldLoadAdjacentModule = !ctx.IgnoreAdjacentModules;
|
||||
|
||||
// Don't use the adjacent swiftmodule for frameworks from the public
|
||||
// Frameworks folder of the SDK.
|
||||
@@ -1031,7 +1031,8 @@ class ModuleInterfaceLoaderImpl {
|
||||
ctx.SourceMgr, diagsToUse,
|
||||
astDelegate, interfacePath, moduleName, cacheDir,
|
||||
prebuiltCacheDir, backupInterfaceDir, StringRef(),
|
||||
Opts.disableInterfaceLock, diagnosticLoc,
|
||||
Opts.disableInterfaceLock,
|
||||
ctx.IgnoreAdjacentModules, diagnosticLoc,
|
||||
dependencyTracker);
|
||||
// If we found an out-of-date .swiftmodule, we still want to add it as
|
||||
// a dependency of the .swiftinterface. That way if it's updated, but
|
||||
@@ -1063,7 +1064,8 @@ class ModuleInterfaceLoaderImpl {
|
||||
ImplicitModuleInterfaceBuilder fallbackBuilder(
|
||||
ctx.SourceMgr, &ctx.Diags, astDelegate, backupPath, moduleName, cacheDir,
|
||||
prebuiltCacheDir, backupInterfaceDir, StringRef(),
|
||||
Opts.disableInterfaceLock, diagnosticLoc,
|
||||
Opts.disableInterfaceLock,
|
||||
ctx.IgnoreAdjacentModules, diagnosticLoc,
|
||||
dependencyTracker);
|
||||
if (rebuildInfo.sawOutOfDateModule(modulePath))
|
||||
fallbackBuilder.addExtraDependency(modulePath);
|
||||
@@ -1247,7 +1249,8 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
|
||||
StringRef OutPath, StringRef ABIOutputPath,
|
||||
bool SerializeDependencyHashes,
|
||||
bool TrackSystemDependencies, ModuleInterfaceLoaderOptions LoaderOpts,
|
||||
RequireOSSAModules_t RequireOSSAModules) {
|
||||
RequireOSSAModules_t RequireOSSAModules,
|
||||
bool silenceInterfaceDiagnostics) {
|
||||
InterfaceSubContextDelegateImpl astDelegate(
|
||||
SourceMgr, &Diags, SearchPathOpts, LangOpts, ClangOpts, LoaderOpts,
|
||||
/*CreateCacheDirIfAbsent*/ true, CacheDir, PrebuiltCacheDir,
|
||||
@@ -1256,7 +1259,8 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
|
||||
ImplicitModuleInterfaceBuilder builder(SourceMgr, &Diags, astDelegate, InPath,
|
||||
ModuleName, CacheDir, PrebuiltCacheDir,
|
||||
BackupInterfaceDir, ABIOutputPath,
|
||||
LoaderOpts.disableInterfaceLock);
|
||||
LoaderOpts.disableInterfaceLock,
|
||||
silenceInterfaceDiagnostics);
|
||||
// FIXME: We really only want to serialize 'important' dependencies here, if
|
||||
// we want to ship the built swiftmodules to another machine.
|
||||
auto failed = builder.buildSwiftModule(OutPath, /*shouldSerializeDeps*/true,
|
||||
@@ -1274,7 +1278,8 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
|
||||
ImplicitModuleInterfaceBuilder backupBuilder(SourceMgr, &Diags, astDelegate, backInPath,
|
||||
ModuleName, CacheDir, PrebuiltCacheDir,
|
||||
BackupInterfaceDir, ABIOutputPath,
|
||||
LoaderOpts.disableInterfaceLock);
|
||||
LoaderOpts.disableInterfaceLock,
|
||||
silenceInterfaceDiagnostics);
|
||||
// Ensure we can rebuild module after user changed the original interface file.
|
||||
backupBuilder.addExtraDependency(InPath);
|
||||
// FIXME: We really only want to serialize 'important' dependencies here, if
|
||||
|
||||
Reference in New Issue
Block a user