Skip to content

Commit 574ee39

Browse files
committed
Stage in frontend flags for experimental cross-module incremental builds
1 parent 48415ad commit 574ee39

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ class FrontendOptions {
276276
/// of the main Swift module's source files.
277277
bool ImportPrescan = false;
278278

279+
/// When performing an incremental build, ensure that cross-module incremental
280+
/// build metadata is available in any swift modules emitted by this frontend
281+
/// job.
282+
///
283+
/// This flag is currently only propagated from the driver to
284+
/// any merge-modules jobs.
285+
bool EnableExperimentalCrossModuleIncrementalBuild = false;
286+
279287
/// The different modes for validating TBD against the LLVM IR.
280288
enum class TBDValidationMode {
281289
Default, ///< Do the default validation for the current platform.

include/swift/Serialization/SerializationOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ namespace swift {
131131
bool SerializeAllSIL = false;
132132
bool SerializeOptionsForDebugging = false;
133133
bool IsSIB = false;
134+
bool ExperimentalCrossModuleIncrementalInfo = false;
134135
};
135136

136137
} // end namespace swift

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ bool ArgsToFrontendOptionsConverter::convert(
9292

9393
Opts.ImportPrescan |= Args.hasArg(OPT_import_prescan);
9494

95+
Opts.EnableExperimentalCrossModuleIncrementalBuild |=
96+
Args.hasArg(OPT_enable_experimental_cross_module_incremental_build);
97+
9598
// Always track system dependencies when scanning dependencies.
9699
if (const Arg *ModeArg = Args.getLastArg(OPT_modes_Group)) {
97100
if (ModeArg->getOption().matches(OPT_scan_dependencies)) {

lib/Frontend/Frontend.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
175175
opts.SerializeOptionsForDebugging.getValueOr(
176176
!isModuleExternallyConsumed(module));
177177

178+
serializationOpts.ExperimentalCrossModuleIncrementalInfo =
179+
opts.EnableExperimentalCrossModuleIncrementalBuild;
180+
178181
return serializationOpts;
179182
}
180183

test/Driver/cross_module.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %empty-directory(%t/sub)
2+
// RUN: echo "{\"\": {\"swift-dependencies\": \"cross_module.swiftdeps\"}}" > %t/ofm.json
3+
// RUN: %swiftc_driver -incremental -emit-module -module-name cross_module -output-file-map=%/t/ofm.json -driver-print-jobs -target x86_64-apple-macosx10.9 %s -enable-experimental-cross-module-incremental-build 2>^1 | %FileCheck -check-prefix ENABLE %s
4+
5+
// ENABLE: {{bin(/|\\\\)swift(-frontend|c)?(\.exe)?"?}} -frontend -merge-modules
6+
// ENABLE-SAME: -enable-experimental-cross-module-incremental-build

0 commit comments

Comments
 (0)