Skip to content

Commit cfb5fcd

Browse files
committed
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
1 parent 93083f5 commit cfb5fcd

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,6 @@ WARNING(warning_module_shadowing_may_break_module_interface,none,
377377
/*shadowedModule=*/ModuleDecl *, /*interfaceModule*/ModuleDecl *))
378378
REMARK(rebuilding_module_from_interface,none,
379379
"rebuilding module '%0' from interface '%1'", (StringRef, StringRef))
380-
REMARK(rebuilding_stdlib_from_interface,none,
381-
"did not find a prebuilt standard library for target '%0' compatible "
382-
"with this Swift compiler; building it may take a few minutes, but it "
383-
"should only happen once for this combination of compiler and target",
384-
(StringRef))
385380
NOTE(sdk_version_pbm_version,none,
386381
"SDK build version is '%0'; prebuilt modules were "
387382
"built using SDK build version: '%1'", (StringRef, StringRef))

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -981,21 +981,9 @@ class ModuleInterfaceLoaderImpl {
981981
diag::rebuilding_module_from_interface, moduleName,
982982
interfacePath);
983983
};
984-
// Diagnose only for the standard library; it should be prebuilt in typical
985-
// workflows, but if it isn't, building it may take several minutes and a
986-
// lot of memory, so users may think the compiler is busy-hung.
987-
auto remarkRebuildStdlib = [&]() {
988-
if (moduleName != "Swift")
989-
return;
990-
991-
auto moduleTriple = getTargetSpecificModuleTriple(ctx.LangOpts.Target);
992-
rebuildInfo.diagnose(ctx, diags, prebuiltCacheDir, SourceLoc(),
993-
diag::rebuilding_stdlib_from_interface,
994-
moduleTriple.str());
995-
};
996984
auto remarkRebuild = Opts.remarkOnRebuildFromInterface
997985
? llvm::function_ref<void()>(remarkRebuildAll)
998-
: remarkRebuildStdlib;
986+
: nullptr;
999987

1000988
bool failed = false;
1001989
std::string backupPath = getBackupPublicModuleInterfacePath();

test/ModuleInterface/stdlib_rebuild.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t.mcps)
22

3-
// 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
3+
// 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
44
// 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
55
// 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
66

@@ -17,8 +17,6 @@ import OtherModule
1717

1818
func fn(_: Int) {}
1919

20-
// 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
21-
2220
// NORMAL-DIAG-DAG: remark: rebuilding module 'Swift' from interface '{{.*}}'
2321
// NORMAL-DIAG-DAG: remark: rebuilding module '_Concurrency' from interface '{{.*}}'
2422

0 commit comments

Comments
 (0)