mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Add support for diagnosing invalid architecture swift binary module candidates
Refactor 'maybeDiagnoseTargetMismatch' to separately collect mismatching target variant modules in 'identifyArchitectureVariants' and rename it to 'handlePossibleTargetMismatch'. Prior uses of 'maybeDiagnoseTargetMismatch' will continue diagnosing errors/warnings on only discovering incompatible swift binary module target variants. A new overload of 'handlePossibleTargetMismatch', in 'SwiftModuleScanner', instead collects it as a discovered incompatible candidate, for diagnosis downstream.
This commit is contained in:
@@ -151,14 +151,23 @@ protected:
|
||||
/// to list the architectures that \e are present.
|
||||
///
|
||||
/// \returns true if an error diagnostic was emitted
|
||||
virtual bool maybeDiagnoseTargetMismatch(
|
||||
virtual bool handlePossibleTargetMismatch(
|
||||
SourceLoc sourceLocation,
|
||||
StringRef moduleName,
|
||||
const SerializedModuleBaseName &BaseName,
|
||||
const SerializedModuleBaseName &baseName,
|
||||
bool isCanImportLookup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Assuming the \c baseName is a target-specific Swift module path,
|
||||
/// for a missing target variant, collect all adjacent binary module
|
||||
/// files to build a list of discovered modules for incompatible
|
||||
/// architectures.
|
||||
static void identifyArchitectureVariants(
|
||||
ASTContext &Ctx,
|
||||
const SerializedModuleBaseName &baseName,
|
||||
std::vector<std::string> &incompatibleArchModules);
|
||||
|
||||
/// Determines if the provided path is a cached artifact for dependency
|
||||
/// tracking purposes.
|
||||
virtual bool isCached(StringRef DepPath) {
|
||||
@@ -282,7 +291,7 @@ class ImplicitSerializedModuleLoader : public SerializedModuleLoaderBase {
|
||||
bool IsCanImportLookup, bool IsFramework,
|
||||
bool IsTestableDependencyLookup = false) override;
|
||||
|
||||
bool maybeDiagnoseTargetMismatch(
|
||||
bool handlePossibleTargetMismatch(
|
||||
SourceLoc sourceLocation,
|
||||
StringRef moduleName,
|
||||
const SerializedModuleBaseName &BaseName,
|
||||
|
||||
Reference in New Issue
Block a user