Skip to content

Commit 29fa909

Browse files
committed
[Driver] Add an assert to check assumption on allowsResponseFiles.
1 parent 0f26b9c commit 29fa909

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Driver/ToolChain.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,18 @@ ToolChain::constructBatchJob(ArrayRef<const Job *> unsortedJobs,
344344
JobContext context{C, inputJobs.getArrayRef(), inputActions.getArrayRef(),
345345
*output, OI};
346346
auto invocationInfo = constructInvocation(*batchCJA, context);
347+
// Batch mode can produce quite long command lines; in almost every case these
348+
// will trigger use of supplementary output file maps, but in some rare corner
349+
// cases (very few files, very long paths) they might not. However, in those
350+
// cases we _should_ degrade to using response files to pass arguments to the
351+
// frontend, which is done automatically by code elsewhere.
352+
//
353+
// The `allowsResponseFiles` flag on the `invocationInfo` we have here exists
354+
// only to model external tools that don't know about response files, such as
355+
// platform linkers; when talking to the frontend (which we control!) it
356+
// should always be true. But double check with an assert here in case someone
357+
// failed to set it in `constructInvocation`.
358+
assert(invocationInfo.allowsResponseFiles);
347359
return llvm::make_unique<BatchJob>(
348360
*batchCJA, inputJobs.takeVector(), std::move(output), executablePath,
349361
std::move(invocationInfo.Arguments),

0 commit comments

Comments
 (0)