[ModuleInterface] Implement silencing errors on rebuild with a new engine

This commit is contained in:
Alexis Laferrière
2022-10-31 07:48:43 -07:00
parent 82f63b090e
commit 5d59a8fe16
2 changed files with 33 additions and 1 deletions

View File

@@ -320,11 +320,19 @@ bool ImplicitModuleInterfaceBuilder::buildSwiftModuleInternal(
llvm::RestorePrettyStackState(savedInnerPrettyStackState);
};
Optional<DiagnosticEngine> localDiags;
DiagnosticEngine *rebuildDiags = diags;
if (silenceInterfaceDiagnostics) {
// To silence diagnostics, use a local temporary engine.
localDiags.emplace(sourceMgr);
rebuildDiags = &*localDiags;
}
SubError = (bool)subASTDelegate.runInSubCompilerInstance(
moduleName, interfacePath, OutPath, diagnosticLoc,
[&](SubCompilerInstanceInfo &info) {
auto EBuilder = ExplicitModuleInterfaceBuilder(
*info.Instance, diags, sourceMgr, moduleCachePath, backupInterfaceDir,
*info.Instance, rebuildDiags, sourceMgr, moduleCachePath, backupInterfaceDir,
prebuiltCachePath, ABIDescriptorPath, extraDependencies, diagnosticLoc,
dependencyTracker);
return EBuilder.buildSwiftModuleFromInterface(