Skip to content

Commit 4cdbcb8

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 2af325f commit 4cdbcb8

File tree

6 files changed

+27
-45
lines changed

6 files changed

+27
-45
lines changed

include/swift/Basic/LangOptions.h

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

276-
/// Emit a remark on early exit in explicit interface build
277-
bool EnableSkipExplicitInterfaceModuleBuildRemarks = false;
278-
279276
///
280277
/// Support for alternate usage modes
281278
///

lib/Frontend/CompilerInvocation.cpp

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

1481-
Opts.EnableSkipExplicitInterfaceModuleBuildRemarks = Args.hasArg(OPT_remark_skip_explicit_interface_build);
1482-
14831481
if (Args.hasArg(OPT_experimental_skip_non_exportable_decls)) {
14841482
// Only allow -experimental-skip-non-exportable-decls if either library
14851483
// 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);

test/Frontend/output_determinism_check.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
// RUN: %target-swift-frontend -scan-dependencies -module-name test -o %t/test.json %s -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=DEPSCAN_OUTPUT
1515
/// TODO: Implicit module build use a different compiler instance so it doesn't support checking yet.
1616
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/test.swiftinterface %s -O -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=INTERFACE_OUTPUT
17+
1718
/// Hit cache and not emit the second time.
18-
// RUN: rm %t/test.swiftmodule
19-
// RUN: not %target-swift-frontend -compile-module-from-interface %t/test.swiftinterface -explicit-interface-module-build -o %t/test.swiftmodule -enable-deterministic-check 2>&1 | %FileCheck --check-prefix=MODULE_MISMATCH %s
20-
/// Force swiftmodule generation.
21-
// RUN: %target-swift-frontend -compile-module-from-interface %t/test.swiftinterface -explicit-interface-module-build -o %t/test.swiftmodule -enable-deterministic-check -always-compile-output-files 2>&1 | %FileCheck --check-prefix=MODULE_OUTPUT %s
19+
// RUN: %target-swift-frontend -compile-module-from-interface %t/test.swiftinterface -explicit-interface-module-build -o %t/test.swiftmodule -enable-deterministic-check 2>&1 | %FileCheck --check-prefix=MODULE_OUTPUT %s
2220

2321
// RUN: %target-swift-frontend -emit-pcm -module-name UserClangModule -o %t/test.pcm %S/Inputs/dependencies/module.modulemap -enable-deterministic-check 2>&1 | %FileCheck %s --check-prefix=PCM_OUTPUT
2422

@@ -34,7 +32,6 @@
3432
// OBJECT_MISMATCH: error: output file '{{.*}}{{/|\\}}test.o' is missing from second compilation for deterministic check
3533
// DEPSCAN_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.json'
3634
// INTERFACE_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.swiftinterface'
37-
// MODULE_MISMATCH: error: output file '{{.*}}{{/|\\}}test.swiftmodule' is missing from second compilation for deterministic check
3835
// PCM_OUTPUT: remark: produced matching output file '{{.*}}{{/|\\}}test.pcm'
3936

4037
public var x = 1

test/ModuleInterface/repeated-explicit-interface-build-nop.swiftinterface

Lines changed: 0 additions & 14 deletions
This file was deleted.
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)