Skip to content

Commit 7af1974

Browse files
committed
[Explicit Module Builds] Always rebuild the target module in explicit -compile-module-from-interface builds.
We have long switched to delegate the checking of whether a module is up-to-date to the build system (SwiftDriver) and stopped serializing file dependencies for interface-built binary modules. Resolves rdar://162881032
1 parent cb4cb70 commit 7af1974

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ namespace swift {
270270
/// Emit a remark when indexing a system module.
271271
bool EnableIndexingSystemModuleRemarks = false;
272272

273-
/// Emit a remark on early exit in explicit interface build
274-
bool EnableSkipExplicitInterfaceModuleBuildRemarks = false;
275-
276273
///
277274
/// Support for alternate usage modes
278275
///

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,8 +1469,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
14691469
Opts.EnableMacroLoadingRemarks = Args.hasArg(OPT_remark_macro_loading);
14701470
Opts.EnableIndexingSystemModuleRemarks = Args.hasArg(OPT_remark_indexing_system_module);
14711471

1472-
Opts.EnableSkipExplicitInterfaceModuleBuildRemarks = Args.hasArg(OPT_remark_skip_explicit_interface_build);
1473-
14741472
if (Args.hasArg(OPT_experimental_skip_non_exportable_decls)) {
14751473
// Only allow -experimental-skip-non-exportable-decls if either library
14761474
// evolution is enabled (in which case the module's ABI is independent of

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,27 +1609,6 @@ bool ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
16091609
StringRef outputPath, bool ShouldSerializeDeps,
16101610
ArrayRef<std::string> CompiledCandidates,
16111611
DependencyTracker *tracker) {
1612-
1613-
if (!Instance.getInvocation().getIRGenOptions().AlwaysCompile) {
1614-
// First, check if the expected output already exists and possibly
1615-
// up-to-date w.r.t. all of the dependencies it was built with. If so, early
1616-
// exit.
1617-
UpToDateModuleCheker checker(
1618-
Instance.getASTContext());
1619-
ModuleRebuildInfo rebuildInfo;
1620-
SmallVector<FileDependency, 3> allDeps;
1621-
std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
1622-
if (checker.swiftModuleIsUpToDate(outputPath, rebuildInfo, allDeps,
1623-
moduleBuffer)) {
1624-
if (Instance.getASTContext()
1625-
.LangOpts.EnableSkipExplicitInterfaceModuleBuildRemarks) {
1626-
Instance.getDiags().diagnose(
1627-
SourceLoc(), diag::explicit_interface_build_skipped, outputPath);
1628-
}
1629-
return false;
1630-
}
1631-
}
1632-
16331612
// Read out the compiler version.
16341613
llvm::BumpPtrAllocator alloc;
16351614
llvm::StringSaver ArgSaver(alloc);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/module-cache)
3+
// RUN: %empty-directory(%t/Foo.swiftmodule)
4+
// RUN: split-file %s %t
5+
6+
// Build module from interface
7+
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Foo.swiftmodule/Foo.swiftmodule -module-name Foo %t/Foo.swiftmodule/Foo.swiftinterface -explicit-interface-module-build
8+
9+
// Add to the textual interface
10+
// RUN: echo "struct GoodBye {}" >> %t/Foo.swiftmodule/Foo.swiftinterface
11+
12+
// Build module from interface
13+
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Foo.swiftmodule/Foo.swiftmodule -module-name Foo %t/Foo.swiftmodule/Foo.swiftinterface -explicit-interface-module-build
14+
15+
// Get the list of strings and ensure the binary module reflects the new addition
16+
// RUN: %llvm-strings %t/Foo.swiftmodule/Foo.swiftmodule > %t/module_strings.txt
17+
18+
// RUN: cat %t/module_strings.txt | %FileCheck %s
19+
// CHECK-DAG: Hello
20+
// CHECK-DAG: GoodBye
21+
22+
//--- Foo.swiftmodule/Foo.swiftinterface
23+
// swift-interface-format-version: 1.0
24+
// swift-module-flags: -module-name Foo
25+
struct Hello {}

0 commit comments

Comments
 (0)