Skip to content

Commit a9916df

Browse files
committed
[BatchMode] Address review comments.
1 parent 0b4e7db commit a9916df

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

include/swift/Driver/Driver.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ class OutputInfo {
6464
/// A compilation using a single frontend invocation without -primary-file.
6565
SingleCompile,
6666

67-
/// A single process that batches together multiple StandardCompile jobs.
67+
/// A single process that batches together multiple StandardCompile Jobs.
68+
///
69+
/// Note: this is a transient value to use _only_ for the individual
70+
/// BatchJobs that are the temporary containers for multiple StandardCompile
71+
/// Jobs built by ToolChain::constructBatchJob.
72+
///
73+
/// In particular, the driver treats a batch-mode-enabled Compilation as
74+
/// having OutputInfo::CompilerMode == StandardCompile, with the
75+
/// Compilation::BatchModeEnabled flag set to true, _not_ as a
76+
/// BatchModeCompile Compilation. The top-level OutputInfo::CompilerMode for
77+
/// a Compilation should never be BatchModeCompile.
6878
BatchModeCompile,
6979

7080
/// Invoke the REPL

lib/Driver/Driver.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,19 +1403,18 @@ Driver::computeCompilerMode(const DerivedArgList &Args,
14031403
options::OPT_disable_batch_mode,
14041404
false);
14051405

1406-
if (ArgRequiringSingleCompile) {
1407-
// Override batch mode if given -wmo or -index-file.
1408-
if (BatchModeOut) {
1409-
BatchModeOut = false;
1410-
// Emit a warning about such overriding (FIXME: we might conditionalize
1411-
// this based on the user or xcode passing -disable-batch-mode).
1412-
Diags.diagnose(SourceLoc(), diag::warn_ignoring_batch_mode,
1413-
ArgRequiringSingleCompile->getOption().getPrefixedName());
1414-
}
1415-
return OutputInfo::Mode::SingleCompile;
1416-
}
1417-
1418-
return OutputInfo::Mode::StandardCompile;
1406+
if (!ArgRequiringSingleCompile)
1407+
return OutputInfo::Mode::StandardCompile;
1408+
1409+
// Override batch mode if given -wmo or -index-file.
1410+
if (BatchModeOut) {
1411+
BatchModeOut = false;
1412+
// Emit a warning about such overriding (FIXME: we might conditionalize
1413+
// this based on the user or xcode passing -disable-batch-mode).
1414+
Diags.diagnose(SourceLoc(), diag::warn_ignoring_batch_mode,
1415+
ArgRequiringSingleCompile->getOption().getPrefixedName());
1416+
}
1417+
return OutputInfo::Mode::SingleCompile;
14191418
}
14201419

14211420
void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,

0 commit comments

Comments
 (0)