[5.10 🍒][ClangImporter] On failing a module lookup, reset Clang's DiagnosticEngine, in addition to filtering out the "module not found" diagnostic #68744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #68549
• Release: Swift 5.10
• Explanation: Even though
ClangDiagnosticConsumerfilters outclang::diag::err_module_not_foundfrom being emitted by the Swift compiler, delegating to Swift's module-loading logic for error-handling, we must also ensure that we reset Clang'sDiagnosticEngine's error count. Otherwise, if we do not, final stages ofIRGenwill query Clang's code-gen to finalize itsModule, which Clang will not do if its internalDiagnosticEnginecontains errors. This will cause Swift'sIRGento fail, even though the only error emitted was one Swift intended to suppress.• Scope of Issue: Some projects which fail to resolve optional transitive module dependencies may fail to build with explicit modules enabled.
• Reviewed by: @tshortli
• Risk: Minimal, this change only affects the code-path which currently leads to a hard compilation failure.
• Origination: Explicit Module Build feature development.
Resolves rdar://109426243