Skip to content

Commit 2a30e25

Browse files
committed
Only keep a "const char*" for the response file argument.
1 parent fe4f21d commit 2a30e25

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

include/swift/Driver/Job.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class Job {
277277
/// Argument vector containing a single argument pointing to the response file
278278
/// path with the '@' prefix.
279279
/// The argument string must be kept alive as long as the Job is alive.
280-
llvm::opt::ArgStringList ResponseFileArg;
280+
const char *ResponseFileArg;
281281

282282
/// The modification time of the main input file, if any.
283283
llvm::sys::TimePoint<> InputModTime = llvm::sys::TimePoint<>::max();
@@ -291,14 +291,14 @@ class Job {
291291
EnvironmentVector ExtraEnvironment = {},
292292
std::vector<FilelistInfo> Infos = {},
293293
const char *ResponseFilePath = nullptr,
294-
llvm::opt::ArgStringList ResponseFileArg = {})
294+
const char *ResponseFileArg = nullptr)
295295
: SourceAndCondition(&Source, Condition::Always),
296296
Inputs(std::move(Inputs)), Output(std::move(Output)),
297297
Executable(Executable), Arguments(std::move(Arguments)),
298298
ExtraEnvironment(std::move(ExtraEnvironment)),
299299
FilelistFileInfos(std::move(Infos)),
300300
ResponseFilePath(ResponseFilePath),
301-
ResponseFileArg(std::move(ResponseFileArg)) {}
301+
ResponseFileArg(ResponseFileArg) {}
302302

303303
virtual ~Job();
304304

@@ -308,7 +308,7 @@ class Job {
308308

309309
const char *getExecutable() const { return Executable; }
310310
const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
311-
const llvm::opt::ArgStringList &getResponseFileArg() const { return ResponseFileArg; }
311+
const char * const &getResponseFileArg() const { return ResponseFileArg; }
312312
ArrayRef<FilelistInfo> getFilelistInfos() const { return FilelistFileInfos; }
313313

314314
ArrayRef<const Job *> getInputs() const { return Inputs; }

lib/Driver/Job.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void Job::printCommandLine(raw_ostream &os, StringRef Terminator) const {
354354
escapeAndPrintString(os, Executable);
355355
os << ' ';
356356
if (hasResponseFile()) {
357-
printArguments(os, ResponseFileArg);
357+
printArguments(os, {ResponseFileArg});
358358
} else {
359359
printArguments(os, Arguments);
360360
}

lib/Driver/ToolChain.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,12 @@ std::unique_ptr<Job> ToolChain::constructJob(
115115
}
116116

117117
const char *responseFilePath = nullptr;
118-
llvm::opt::ArgStringList responseFileArg = {};
118+
const char *responseFileArg = nullptr;
119119
if (invocationInfo.allowsResponseFiles &&
120120
!llvm::sys::commandLineFitsWithinSystemLimits(
121121
executablePath, invocationInfo.Arguments)) {
122122
responseFilePath = context.getTemporaryFilePath("arguments", "resp");
123-
responseFileArg.push_back(
124-
C.getArgs().MakeArgString(Twine("@") + responseFilePath));
123+
responseFileArg = C.getArgs().MakeArgString(Twine("@") + responseFilePath);
125124
}
126125

127126
return llvm::make_unique<Job>(JA, std::move(inputs), std::move(output),
@@ -130,7 +129,7 @@ std::unique_ptr<Job> ToolChain::constructJob(
130129
std::move(invocationInfo.ExtraEnvironment),
131130
std::move(invocationInfo.FilelistInfos),
132131
responseFilePath,
133-
std::move(responseFileArg));
132+
responseFileArg);
134133
}
135134

136135
std::string

0 commit comments

Comments
 (0)