Skip to content

Commit 0c2c756

Browse files
author
David Ungar
authored
Merge pull request #20078 from davidungar/manual-rebasing-exp-deps
[Experimental Dependencies] Add -enable-experimental-dependencies and push it through.
2 parents d94d925 + 19caf59 commit 0c2c756

File tree

7 files changed

+33
-5
lines changed

7 files changed

+33
-5
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ namespace swift {
288288
/// Whether to verify the parsed syntax tree and emit related diagnostics.
289289
bool VerifySyntaxTree = false;
290290

291+
/// Scaffolding to permit experimentation with finer-grained dependencies
292+
/// and faster rebuilds.
293+
bool EnableExperimentalDependencies = false;
294+
291295
/// Sets the target we are building for and updates platform conditions
292296
/// to match.
293297
///

include/swift/Driver/Compilation.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ class Compilation {
206206
/// limit filelists will be used.
207207
size_t FilelistThreshold;
208208

209+
/// Scaffolding to permit experimentation with finer-grained dependencies and
210+
/// faster rebuilds.
211+
const bool EnableExperimentalDependencies;
212+
209213
template <typename T>
210214
static T *unwrap(const std::unique_ptr<T> &p) {
211215
return p.get();
@@ -234,7 +238,8 @@ class Compilation {
234238
Optional<unsigned> BatchSizeLimit = None,
235239
bool SaveTemps = false,
236240
bool ShowDriverTimeCompilation = false,
237-
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr);
241+
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
242+
bool EnableExperimentalDependencies = false);
238243
~Compilation();
239244

240245
ToolChain const &getToolChain() const {
@@ -289,6 +294,10 @@ class Compilation {
289294
EnableIncrementalBuild = false;
290295
}
291296

297+
bool getEnableExperimentalDependencies() const {
298+
return EnableExperimentalDependencies;
299+
}
300+
292301
bool getBatchModeEnabled() const {
293302
return EnableBatchMode;
294303
}

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ def driver_always_rebuild_dependents :
129129
Flag<["-"], "driver-always-rebuild-dependents">, InternalDebugOpt,
130130
HelpText<"Always rebuild dependents of files that have been modified">;
131131

132+
def enable_experimental_dependencies :
133+
Flag<["-"], "enable-experimental-dependencies">, Flags<[FrontendOption, HelpHidden]>,
134+
HelpText<"Experimental work-in-progress to be more selective about incremental recompilation">;
135+
132136
def driver_mode : Joined<["--"], "driver-mode=">, Flags<[HelpHidden]>,
133137
HelpText<"Set the driver mode to either 'swift' or 'swiftc'">;
134138

lib/Driver/Compilation.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ Compilation::Compilation(DiagnosticEngine &Diags,
117117
Optional<unsigned> BatchSizeLimit,
118118
bool SaveTemps,
119119
bool ShowDriverTimeCompilation,
120-
std::unique_ptr<UnifiedStatsReporter> StatsReporter)
120+
std::unique_ptr<UnifiedStatsReporter> StatsReporter,
121+
bool EnableExperimentalDependencies)
121122
: Diags(Diags), TheToolChain(TC),
122123
TheOutputInfo(OI),
123124
Level(Level),
@@ -138,7 +139,9 @@ Compilation::Compilation(DiagnosticEngine &Diags,
138139
SaveTemps(SaveTemps),
139140
ShowDriverTimeCompilation(ShowDriverTimeCompilation),
140141
Stats(std::move(StatsReporter)),
141-
FilelistThreshold(FilelistThreshold) {
142+
FilelistThreshold(FilelistThreshold),
143+
EnableExperimentalDependencies(EnableExperimentalDependencies) {
144+
142145
};
143146

144147
static bool writeFilelistIfNecessary(const Job *job, const ArgList &args,

lib/Driver/Driver.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,9 @@ Driver::buildCompilation(const ToolChain &TC,
920920
ArgList->hasArg(options::OPT_driver_time_compilation);
921921
std::unique_ptr<UnifiedStatsReporter> StatsReporter =
922922
createStatsReporter(ArgList.get(), Inputs, OI, DefaultTargetTriple);
923-
923+
const bool EnableExperimentalDependencies =
924+
ArgList->hasArg(options::OPT_enable_experimental_dependencies);
925+
924926
C = llvm::make_unique<Compilation>(
925927
Diags, TC, OI, Level,
926928
std::move(ArgList),
@@ -939,7 +941,8 @@ Driver::buildCompilation(const ToolChain &TC,
939941
DriverBatchSizeLimit,
940942
SaveTemps,
941943
ShowDriverTimeCompilation,
942-
std::move(StatsReporter));
944+
std::move(StatsReporter),
945+
EnableExperimentalDependencies);
943946
}
944947

945948
// Construct the graph of Actions.

lib/Driver/ToolChains.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
218218
inputArgs.AddLastArg(arguments, options::OPT_O_Group);
219219
inputArgs.AddLastArg(arguments, options::OPT_RemoveRuntimeAsserts);
220220
inputArgs.AddLastArg(arguments, options::OPT_AssumeSingleThreaded);
221+
inputArgs.AddLastArg(arguments,
222+
options::OPT_enable_experimental_dependencies);
221223

222224
// Pass on any build config options
223225
inputArgs.AddAllArgs(arguments, options::OPT_D);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
273273
Opts.BuildSyntaxTree = true;
274274
Opts.VerifySyntaxTree = true;
275275
}
276+
277+
if (Args.hasArg(OPT_enable_experimental_dependencies))
278+
Opts.EnableExperimentalDependencies = true;
276279

277280
Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support);
278281
if (Opts.DebuggerSupport)

0 commit comments

Comments
 (0)