Skip to content

Commit d68c791

Browse files
committed
Remove -incremental when using -whole-module-optimization
Passing both results in noisy remarks when building from the command line like: ``` remark: Incremental compilation has been disabled: it is not compatible with whole module optimization ``` https://forums.swift.org/t/incremental-compilation-has-been-disabled-it-is-not-compatible-with-whole-module-optimization/66092
1 parent a0c5e54 commit d68c791

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/BuildSystem/BuildSystem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,8 +2583,7 @@ class SwiftCompilerShellCommand : public ExternalCommand {
25832583
result.push_back("-module-alias");
25842584
result.push_back(nameAndAlias);
25852585
}
2586-
2587-
result.push_back("-incremental");
2586+
25882587
result.push_back("-emit-dependencies");
25892588
if (!moduleOutputPath.empty()) {
25902589
result.push_back("-emit-module");
@@ -2600,6 +2599,8 @@ class SwiftCompilerShellCommand : public ExternalCommand {
26002599
result.push_back("-whole-module-optimization");
26012600
result.push_back("-num-threads");
26022601
result.push_back(numThreads);
2602+
} else {
2603+
result.push_back("-incremental");
26032604
}
26042605
result.push_back("-c");
26052606
for (const auto& source: sourcesList) {

tests/SwiftBuildTool/swift-compiler-whole-module-optimization.swift-build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# RUN: %{FileCheck} --check-prefix=CHECK-VERBOSE --input-file=%t-verbose.out %s
1212
#
1313
# CHECK: Compiling Swift Module 'Foo'
14-
# CHECK-VERBOSE: swiftc -module-name Bar -incremental -emit-dependencies -emit-module -emit-module-path Bar.swiftmodule -output-file-map bar.build/output-file-map.json -parse-as-library -whole-module-optimization -num-threads 1 -c s1.swift -I importB
15-
# CHECK-VERBOSE: swiftc -module-name Foo -incremental -emit-dependencies -emit-module -emit-module-path Foo.swiftmodule -output-file-map foo.build/output-file-map.json -parse-as-library -whole-module-optimization -num-threads 0 -c s1.swift s2.swift -I importA -I importB -Onone -I somePath
14+
# CHECK-VERBOSE: swiftc -module-name Bar -emit-dependencies -emit-module -emit-module-path Bar.swiftmodule -output-file-map bar.build/output-file-map.json -parse-as-library -whole-module-optimization -num-threads 1 -c s1.swift -I importB
15+
# CHECK-VERBOSE: swiftc -module-name Foo -emit-dependencies -emit-module -emit-module-path Foo.swiftmodule -output-file-map foo.build/output-file-map.json -parse-as-library -whole-module-optimization -num-threads 0 -c s1.swift s2.swift -I importA -I importB -Onone -I somePath
1616

1717
# # Sanity check the output file map.
1818
#

tests/SwiftBuildTool/swift-compiler.swift-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#
1313
# CHECK: Compiling Swift Module 'Foo'
1414
# FIXME: This should quote output paths.
15-
# CHECK-VERBOSE: swiftc -module-name Foo -incremental -emit-dependencies -emit-module -emit-module-path Foo.swiftmodule -output-file-map temps/output-file-map.json -parse-as-library -c "s 1.swift" "s 2.swift" -I "import A" -I "import B" -Onone -I "path with spaces"
15+
# CHECK-VERBOSE: swiftc -module-name Foo -emit-dependencies -emit-module -emit-module-path Foo.swiftmodule -output-file-map temps/output-file-map.json -parse-as-library -incremental -c "s 1.swift" "s 2.swift" -I "import A" -I "import B" -Onone -I "path with spaces"
1616

1717
# Sanity check the output file map.
1818
#

0 commit comments

Comments
 (0)