Skip to content

Commit 478d846

Browse files
author
David Ungar
authored
Merge pull request #15769 from davidungar/PR-18-20-driver-consts
[Driver] NFC: Add some "const"s to clarify the code.
2 parents 8353b4c + 906e1ca commit 478d846

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

include/swift/Driver/Compilation.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ class Compilation {
143143

144144
/// The number of commands which this compilation should attempt to run in
145145
/// parallel.
146-
unsigned NumberOfParallelCommands;
146+
const unsigned NumberOfParallelCommands;
147147

148148
/// Indicates whether this Compilation should use skip execution of
149149
/// subtasks during performJobs() by using a dummy TaskQueue.
150150
///
151151
/// \note For testing purposes only; similar user-facing features should be
152152
/// implemented separately, as the dummy TaskQueue may provide faked output.
153-
bool SkipTaskExecution;
153+
const bool SkipTaskExecution;
154154

155155
/// Indicates whether this Compilation should continue execution of subtasks
156156
/// even if they returned an error status.
@@ -172,22 +172,21 @@ class Compilation {
172172
/// Indicates whether groups of parallel frontend jobs should be merged
173173
/// together and run in composite "batch jobs" when possible, to reduce
174174
/// redundant work.
175-
bool EnableBatchMode;
175+
const bool EnableBatchMode;
176176

177177
/// Provides a randomization seed to batch-mode partitioning, for debugging.
178-
unsigned BatchSeed;
178+
const unsigned BatchSeed;
179179

180180
/// In order to test repartitioning, set to true if
181-
/// -driver-force-one-batch-repartition is present. This is cleared after the
182-
/// forced repartition happens.
183-
bool ForceOneBatchRepartition = false;
181+
/// -driver-force-one-batch-repartition is present.
182+
const bool ForceOneBatchRepartition = false;
184183

185184
/// True if temporary files should not be deleted.
186-
bool SaveTemps;
185+
const bool SaveTemps;
187186

188187
/// When true, dumps information on how long each compilation task took to
189188
/// execute.
190-
bool ShowDriverTimeCompilation;
189+
const bool ShowDriverTimeCompilation;
191190

192191
/// When non-null, record various high-level counters to this.
193192
std::unique_ptr<UnifiedStatsReporter> Stats;

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static bool populateOutOfDateMap(InputInfoMap &map,
536536
}
537537

538538
// warn if -embed-bitcode is set and the output type is not an object
539-
static void validateEmbedBitcode(DerivedArgList &Args, OutputInfo &OI,
539+
static void validateEmbedBitcode(DerivedArgList &Args, const OutputInfo &OI,
540540
DiagnosticEngine &Diags) {
541541
if (Args.hasArg(options::OPT_embed_bitcode) &&
542542
OI.CompilerOutputType != file_types::TY_Object) {

0 commit comments

Comments
 (0)