Merge pull request #61980 from xymus/index-fix-silencing-swiftinterface

[ModuleInterface] Fix silencing errors mode in swiftinterface rebuild
This commit is contained in:
Alexis Laferrière
2022-11-08 13:17:58 -08:00
committed by GitHub
5 changed files with 9 additions and 3 deletions

View File

@@ -1725,7 +1725,8 @@ InterfaceSubContextDelegateImpl::runInSubContext(StringRef moduleName,
SourceLoc diagLoc,
llvm::function_ref<std::error_code(ASTContext&, ModuleDecl*, ArrayRef<StringRef>,
ArrayRef<StringRef>, StringRef)> action) {
return runInSubCompilerInstance(moduleName, interfacePath, outputPath, diagLoc,
return runInSubCompilerInstance(moduleName, interfacePath, outputPath,
diagLoc, /*silenceErrors=*/false,
[&](SubCompilerInstanceInfo &info){
return action(info.Instance->getASTContext(),
info.Instance->getMainModule(),
@@ -1740,6 +1741,7 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
StringRef interfacePath,
StringRef outputPath,
SourceLoc diagLoc,
bool silenceErrors,
llvm::function_ref<std::error_code(SubCompilerInstanceInfo&)> action) {
// We are about to mess up the compiler invocation by using the compiler
// arguments in the textual interface file. So copy to use a new compiler
@@ -1834,7 +1836,8 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
subInstance.getSourceMgr().setFileSystem(SM.getFileSystem());
ForwardingDiagnosticConsumer FDC(*Diags);
subInstance.addDiagnosticConsumer(&FDC);
if (!silenceErrors)
subInstance.addDiagnosticConsumer(&FDC);
std::string InstanceSetupError;
if (subInstance.setup(subInvocation, InstanceSetupError)) {
return std::make_error_code(std::errc::not_supported);