Merge pull request #78672 from artemcm/DepScanInvalidRejectedBinaryModulesWarn

[Dependency Scanning] Emit a warning when failing to load a binary module of a non-resilient dependency
This commit is contained in:
Artem Chikin
2025-01-22 15:03:43 -08:00
committed by GitHub
6 changed files with 89 additions and 51 deletions

View File

@@ -325,45 +325,6 @@ struct ModuleRebuildInfo {
return false;
}
const char *invalidModuleReason(serialization::Status status) {
using namespace serialization;
switch (status) {
case Status::FormatTooOld:
return "compiled with an older version of the compiler";
case Status::FormatTooNew:
return "compiled with a newer version of the compiler";
case Status::RevisionIncompatible:
return "compiled with a different version of the compiler";
case Status::ChannelIncompatible:
return "compiled for a different distribution channel";
case Status::NotInOSSA:
return "module was not built with OSSA";
case Status::MissingDependency:
return "missing dependency";
case Status::MissingUnderlyingModule:
return "missing underlying module";
case Status::CircularDependency:
return "circular dependency";
case Status::FailedToLoadBridgingHeader:
return "failed to load bridging header";
case Status::Malformed:
return "malformed";
case Status::MalformedDocumentation:
return "malformed documentation";
case Status::NameMismatch:
return "name mismatch";
case Status::TargetIncompatible:
return "compiled for a different target platform";
case Status::TargetTooNew:
return "target platform newer than current platform";
case Status::SDKMismatch:
return "SDK does not match";
case Status::Valid:
return nullptr;
}
llvm_unreachable("bad status");
}
/// Emits a diagnostic for all out-of-date compiled or forwarding modules
/// encountered while trying to load a module.
template<typename... DiagArgs>
@@ -406,9 +367,9 @@ struct ModuleRebuildInfo {
// If there was a compiled module that wasn't able to be read, diagnose
// the reason we couldn't read it.
if (auto status = mod.serializationStatus) {
if (auto reason = invalidModuleReason(*status)) {
if (auto reason = SerializedModuleLoaderBase::invalidModuleReason(*status)) {
diags.diagnose(loc, diag::compiled_module_invalid_reason,
mod.path, reason);
mod.path, reason.value());
} else {
diags.diagnose(loc, diag::compiled_module_invalid, mod.path);
}