Skip to content

Commit 3a8d4dc

Browse files
author
David Ungar
authored
Merge pull request #19314 from davidungar/rdar-44142091-fix-without-test
Rdar 44142091 fix without test
2 parents 4baa775 + 7792179 commit 3a8d4dc

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ def driver_force_one_batch_repartition : Flag<["-"], "driver-force-one-batch-rep
120120
InternalDebugOpt,
121121
HelpText<"Force one batch repartitioning for testing">;
122122

123+
def driver_force_response_files : Flag<["-"], "driver-force-response-files">,
124+
InternalDebugOpt,
125+
HelpText<"Force the use of response files for testing">;
126+
123127
def driver_always_rebuild_dependents :
124128
Flag<["-"], "driver-always-rebuild-dependents">, InternalDebugOpt,
125129
HelpText<"Always rebuild dependents of files that have been modified">;

lib/Driver/Job.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,8 @@ bool Job::writeArgsToResponseFile() const {
425425
return true;
426426
}
427427
for (const char *arg : Arguments) {
428-
OS << "\"";
429428
escapeAndPrintString(OS, arg);
430-
OS << "\" ";
429+
OS << " ";
431430
}
432431
OS.flush();
433432
return false;

lib/Driver/ToolChain.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,15 @@ std::unique_ptr<Job> ToolChain::constructJob(
116116

117117
const char *responseFilePath = nullptr;
118118
const char *responseFileArg = nullptr;
119-
if (invocationInfo.allowsResponseFiles &&
120-
!llvm::sys::commandLineFitsWithinSystemLimits(
121-
executablePath, invocationInfo.Arguments)) {
119+
120+
const bool forceResponseFiles =
121+
C.getArgs().hasArg(options::OPT_driver_force_response_files);
122+
assert((invocationInfo.allowsResponseFiles || !forceResponseFiles) &&
123+
"Cannot force response file if platform does not allow it");
124+
125+
if (forceResponseFiles || (invocationInfo.allowsResponseFiles &&
126+
!llvm::sys::commandLineFitsWithinSystemLimits(
127+
executablePath, invocationInfo.Arguments))) {
122128
responseFilePath = context.getTemporaryFilePath("arguments", "resp");
123129
responseFileArg = C.getArgs().MakeArgString(Twine("@") + responseFilePath);
124130
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Ensure that -driver-force-response-files works.
2+
3+
4+
// RUN: %swiftc_driver -driver-force-response-files -typecheck %S/../Inputs/empty.swift -### 2>&1 | %FileCheck %s
5+
// CHECK: @
6+
// CHECK: .resp

0 commit comments

Comments
 (0)