Skip to content

Commit 2f79ff7

Browse files
author
David Ungar
authored
Merge pull request #29390 from davidungar/centralizeDefault
[Incremental] Use the initial value of EnableFineGrainedDependencies as the default.
2 parents 35e3371 + 98b86c6 commit 2f79ff7

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

include/swift/Basic/LangOptions.h

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ namespace swift {
298298

299299
/// Emit the newer, finer-grained swiftdeps file. Eventually will support
300300
/// faster rebuilds.
301+
/// The initializer here sets the default for the frontend and driver.
301302
bool EnableFineGrainedDependencies = false;
302303

303304
/// When using fine-grained dependencies, emit dot files for every swiftdeps

include/swift/Driver/Compilation.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "swift/Basic/ArrayRefView.h"
2121
#include "swift/Basic/LLVM.h"
22+
#include "swift/Basic/LangOptions.h"
2223
#include "swift/Basic/NullablePtr.h"
2324
#include "swift/Basic/OutputFileMap.h"
2425
#include "swift/Basic/Statistic.h"
@@ -327,7 +328,8 @@ class Compilation {
327328
bool ShowDriverTimeCompilation = false,
328329
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
329330
bool OnlyOneDependencyFile = false,
330-
bool EnableFineGrainedDependencies = false,
331+
bool EnableFineGrainedDependencies =
332+
LangOptions().EnableFineGrainedDependencies,
331333
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
332334
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
333335
bool FineGrainedDependenciesIncludeIntrafileOnes = false,

lib/Driver/Driver.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "swift/AST/DiagnosticsDriver.h"
2222
#include "swift/AST/DiagnosticsFrontend.h"
2323
#include "swift/Basic/LLVM.h"
24+
#include "swift/Basic/LangOptions.h"
2425
#include "swift/Basic/OutputFileMap.h"
2526
#include "swift/Basic/Platform.h"
2627
#include "swift/Basic/Range.h"
@@ -966,9 +967,11 @@ Driver::buildCompilation(const ToolChain &TC,
966967
options::OPT_disable_only_one_dependency_file, true);
967968

968969
// relies on the new dependency graph
970+
// Get the default from the initializer in LangOptions.
969971
const bool EnableFineGrainedDependencies =
970972
ArgList->hasFlag(options::OPT_enable_fine_grained_dependencies,
971-
options::OPT_disable_fine_grained_dependencies, false);
973+
options::OPT_disable_fine_grained_dependencies,
974+
LangOptions().EnableFineGrainedDependencies);
972975

973976
const bool VerifyFineGrainedDependencyGraphAfterEveryImport = ArgList->hasArg(
974977
options::

lib/Frontend/CompilerInvocation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
428428

429429
Opts.EnableFineGrainedDependencies =
430430
Args.hasFlag(options::OPT_enable_fine_grained_dependencies,
431-
options::OPT_disable_fine_grained_dependencies, false);
431+
options::OPT_disable_fine_grained_dependencies,
432+
Opts.EnableFineGrainedDependencies);
432433

433434
if (Args.hasArg(OPT_emit_fine_grained_dependency_sourcefile_dot_files))
434435
Opts.EmitFineGrainedDependencySourcefileDotFiles = true;

0 commit comments

Comments
 (0)