mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: remark potential version differences between SDK and prebuilt modules
Prebuilt-module directory now contains a SystemVersion.plist file copied from the SDK it's built from. This patch teaches the compiler to remark this version and the SDK version when -Rmodule-interface-rebuild is specified. The difference between these versions could help us debug unusable prebuilt modules.
This commit is contained in:
@@ -286,10 +286,18 @@ struct ModuleRebuildInfo {
|
||||
/// Emits a diagnostic for all out-of-date compiled or forwarding modules
|
||||
/// encountered while trying to load a module.
|
||||
void diagnose(ASTContext &ctx, SourceLoc loc, StringRef moduleName,
|
||||
StringRef interfacePath) {
|
||||
StringRef interfacePath, StringRef prebuiltCacheDir) {
|
||||
ctx.Diags.diagnose(loc, diag::rebuilding_module_from_interface,
|
||||
moduleName, interfacePath);
|
||||
|
||||
auto SDKVer = getSDKBuildVersion(ctx.SearchPathOpts.SDKPath);
|
||||
llvm::SmallString<64> buffer = prebuiltCacheDir;
|
||||
llvm::sys::path::append(buffer, "SystemVersion.plist");
|
||||
auto PBMVer = getSDKBuildVersionFromPlist(buffer.str());
|
||||
if (!SDKVer.empty() && !PBMVer.empty()) {
|
||||
// Remark the potential version difference.
|
||||
ctx.Diags.diagnose(loc, diag::sdk_version_pbm_version, SDKVer,
|
||||
PBMVer);
|
||||
}
|
||||
// We may have found multiple failing modules, that failed for different
|
||||
// reasons. Emit a note for each of them.
|
||||
for (auto &mod : outOfDateModules) {
|
||||
@@ -911,7 +919,7 @@ class ModuleInterfaceLoaderImpl {
|
||||
// Diagnose that we didn't find a loadable module, if we were asked to.
|
||||
auto remarkRebuild = [&]() {
|
||||
rebuildInfo.diagnose(ctx, diagnosticLoc, moduleName,
|
||||
interfacePath);
|
||||
interfacePath, prebuiltCacheDir);
|
||||
};
|
||||
// If we found an out-of-date .swiftmodule, we still want to add it as
|
||||
// a dependency of the .swiftinterface. That way if it's updated, but
|
||||
|
||||
Reference in New Issue
Block a user