mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Frontend] Ensure constraint solving runs salvaging
When index-while-building is enabled, system modules are rebuilt from their interface with diagnostics silenced so failures are not propagated to the build. This is enabled via a local diagnostic engine that has no consumers. Typechecking uses the lack of consumers to add `ConstraintSystemFlags::SuppressDiagnostics`, which controls whether salvaging (and output of diagnostics) is run. There are cases today where salvaging can find a correct solution though, so we should ensure that it's always run. This is a quick workaround for the indexing case - we should instead always run salvaging, regardless of whether diagnostics are suppressed or not. Resolves rdar://117133297.
This commit is contained in:
@@ -329,12 +329,14 @@ bool ImplicitModuleInterfaceBuilder::buildSwiftModuleInternal(
|
||||
llvm::RestorePrettyStackState(savedInnerPrettyStackState);
|
||||
};
|
||||
|
||||
NullDiagnosticConsumer noopConsumer;
|
||||
llvm::Optional<DiagnosticEngine> localDiags;
|
||||
DiagnosticEngine *rebuildDiags = diags;
|
||||
if (silenceInterfaceDiagnostics) {
|
||||
// To silence diagnostics, use a local temporary engine.
|
||||
localDiags.emplace(sourceMgr);
|
||||
rebuildDiags = &*localDiags;
|
||||
rebuildDiags->addConsumer(noopConsumer);
|
||||
}
|
||||
|
||||
SubError = (bool)subASTDelegate.runInSubCompilerInstance(
|
||||
|
||||
Reference in New Issue
Block a user