Skip to content

Commit

Permalink
Remove -incremental when using -whole-module-optimization
Browse files Browse the repository at this point in the history
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
  • Loading branch information
keith committed Jul 19, 2023
1 parent a0c5e54 commit b017cca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/BuildSystem/BuildSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2583,8 +2583,7 @@ class SwiftCompilerShellCommand : public ExternalCommand {
result.push_back("-module-alias");
result.push_back(nameAndAlias);
}

result.push_back("-incremental");

result.push_back("-emit-dependencies");
if (!moduleOutputPath.empty()) {
result.push_back("-emit-module");
Expand All @@ -2600,6 +2599,8 @@ class SwiftCompilerShellCommand : public ExternalCommand {
result.push_back("-whole-module-optimization");
result.push_back("-num-threads");
result.push_back(numThreads);
} else {
result.push_back("-incremental");
}
result.push_back("-c");
for (const auto& source: sourcesList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# RUN: %{FileCheck} --check-prefix=CHECK-VERBOSE --input-file=%t-verbose.out %s
#
# CHECK: Compiling Swift Module 'Foo'
# 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
# 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
# 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
# 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

# # Sanity check the output file map.
#
Expand Down

0 comments on commit b017cca

Please sign in to comment.