ModuleInterface: avoid remarking missing prebuilt module for stdlib by default

Prebuilt modules are only available for certain toolchain and SDK combinations. Therefore,
building modules from interface, even for the stdlib, is expected to happen.

related: rdar://96701615
This commit is contained in:
Xi Ge
2022-07-14 13:34:40 -07:00
parent 93083f595d
commit cfb5fcda0f
3 changed files with 2 additions and 21 deletions

View File

@@ -377,11 +377,6 @@ WARNING(warning_module_shadowing_may_break_module_interface,none,
/*shadowedModule=*/ModuleDecl *, /*interfaceModule*/ModuleDecl *))
REMARK(rebuilding_module_from_interface,none,
"rebuilding module '%0' from interface '%1'", (StringRef, StringRef))
REMARK(rebuilding_stdlib_from_interface,none,
"did not find a prebuilt standard library for target '%0' compatible "
"with this Swift compiler; building it may take a few minutes, but it "
"should only happen once for this combination of compiler and target",
(StringRef))
NOTE(sdk_version_pbm_version,none,
"SDK build version is '%0'; prebuilt modules were "
"built using SDK build version: '%1'", (StringRef, StringRef))

View File

@@ -981,21 +981,9 @@ class ModuleInterfaceLoaderImpl {
diag::rebuilding_module_from_interface, moduleName,
interfacePath);
};
// Diagnose only for the standard library; it should be prebuilt in typical
// workflows, but if it isn't, building it may take several minutes and a
// lot of memory, so users may think the compiler is busy-hung.
auto remarkRebuildStdlib = [&]() {
if (moduleName != "Swift")
return;
auto moduleTriple = getTargetSpecificModuleTriple(ctx.LangOpts.Target);
rebuildInfo.diagnose(ctx, diags, prebuiltCacheDir, SourceLoc(),
diag::rebuilding_stdlib_from_interface,
moduleTriple.str());
};
auto remarkRebuild = Opts.remarkOnRebuildFromInterface
? llvm::function_ref<void()>(remarkRebuildAll)
: remarkRebuildStdlib;
: nullptr;
bool failed = false;
std::string backupPath = getBackupPublicModuleInterfacePath();

View File

@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t.mcps)
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs/stdlib_rebuild -resource-dir %S/Inputs/stdlib_rebuild -module-cache-path %t.mcps/rebuild-remarks-off) -typecheck %s 2>&1 | %FileCheck -check-prefixes SLOW-DIAG,ALL %s
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs/stdlib_rebuild -resource-dir %S/Inputs/stdlib_rebuild -module-cache-path %t.mcps/rebuild-remarks-off) -typecheck %s 2>&1 | %FileCheck -check-prefixes ALL %s
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs/stdlib_rebuild -resource-dir %S/Inputs/stdlib_rebuild -module-cache-path %t.mcps/rebuild-remarks-off) -typecheck %s 2>&1 | %FileCheck -check-prefixes ALL --allow-empty %s
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs/stdlib_rebuild -resource-dir %S/Inputs/stdlib_rebuild -module-cache-path %t.mcps/rebuild-remarks-off) -D OTHER_IMPORT -typecheck %s 2>&1 | %FileCheck -check-prefixes ALL --allow-empty %s
@@ -17,8 +17,6 @@ import OtherModule
func fn(_: Int) {}
// SLOW-DIAG: remark: did not find a prebuilt standard library for target '{{.*}}' compatible with this Swift compiler; building it may take a few minutes, but it should only happen once for this combination of compiler and target
// NORMAL-DIAG-DAG: remark: rebuilding module 'Swift' from interface '{{.*}}'
// NORMAL-DIAG-DAG: remark: rebuilding module '_Concurrency' from interface '{{.*}}'