[4.2 EARLY] [Serialization] Track whether a cross-reference came from Clang #17376
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.
Explanation: Declaration cross-references in swiftmodules are disambiguated by the target declaration's containing module, with the assumption that two modules will never have the same name. However, an overlay has the same name as its underlying Clang module, which means that there can be two declarations with the same name, the same type, and the same module name. This is the underlying cause of the 'UIEdgeInsetsZero' problem, but it also affects the CloudKit overlay. By tracking a bit that just says "this came from Clang", we're able to resolve otherwise ambiguous cross-references.
Scope: Affects how all declaration cross-references are resolved during deserialization of a swiftmodule.
Issue: rdar://problem/40839486
Risk: Medium-low. This should only affect cases that were previously "ambiguous"; that is, where a declaration defined in Swift conflicted with a declaration imported from Clang. But it is a change that exists for all cross-reference resolution.
Testing: Added compiler regression tests, verified that the original project now builds successfully.
Reviewed by: @DougGregor, @rjmccall