mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Warn, instead of fail, when a Swift dependency query only finds modules built for incompatible target
We have adopters who are relying on directly importing the underlying Clang module in the presence of incompatible Swift modules. Resolves rdar://162549210
This commit is contained in:
@@ -2088,6 +2088,19 @@ void ModuleDependencyIssueReporter::diagnoseFailureOnOnlyIncompatibleCandidates(
|
||||
if (candidates.empty())
|
||||
return;
|
||||
|
||||
// FIXME: There are known cases where clients are relying on
|
||||
// loading the underlying Clang module in the presence of a Swift
|
||||
// module which is lacking the required target-specific variant,
|
||||
// such as MacCatalyst. Eventually, we should pursue making this
|
||||
// an error as well.
|
||||
if (llvm::all_of(candidates, [](auto &incompatibleCandidate) {
|
||||
return incompatibleCandidate.incompatibilityReason ==
|
||||
SwiftModuleScannerQueryResult::BUILT_FOR_INCOMPATIBLE_TARGET;
|
||||
})) {
|
||||
warnOnIncompatibleCandidates(moduleImport.importIdentifier, candidates);
|
||||
return;
|
||||
}
|
||||
|
||||
diagnoseModuleNotFoundFailure(moduleImport, cache, dependencyOf,
|
||||
/* resolvingSerializedSearchPath */ std::nullopt,
|
||||
candidates);
|
||||
|
||||
Reference in New Issue
Block a user