Fix response file support for batch jobs.

This commit is contained in:
Tony Allevato
2019-04-12 13:29:50 -07:00
committed by Tony Allevato
parent 9a6fa09729
commit 6d7223023d
5 changed files with 94 additions and 51 deletions

View File

@@ -363,7 +363,7 @@ void Job::printCommandLine(raw_ostream &os, StringRef Terminator) const {
escapeAndPrintString(os, Executable);
os << ' ';
if (hasResponseFile()) {
printArguments(os, {ResponseFileArg});
printArguments(os, {ResponseFile->argString});
os << " # ";
}
printArguments(os, Arguments);
@@ -419,8 +419,9 @@ void Job::printSummary(raw_ostream &os) const {
}
bool Job::writeArgsToResponseFile() const {
assert(hasResponseFile());
std::error_code EC;
llvm::raw_fd_ostream OS(ResponseFilePath, EC, llvm::sys::fs::F_None);
llvm::raw_fd_ostream OS(ResponseFile->path, EC, llvm::sys::fs::F_None);
if (EC) {
return true;
}
@@ -438,9 +439,10 @@ BatchJob::BatchJob(const JobAction &Source,
const char *Executable, llvm::opt::ArgStringList Arguments,
EnvironmentVector ExtraEnvironment,
std::vector<FilelistInfo> Infos,
ArrayRef<const Job *> Combined, int64_t &NextQuasiPID)
ArrayRef<const Job *> Combined, int64_t &NextQuasiPID,
Optional<ResponseFileInfo> ResponseFile)
: Job(Source, std::move(Inputs), std::move(Output), Executable, Arguments,
ExtraEnvironment, Infos),
ExtraEnvironment, Infos, ResponseFile),
CombinedJobs(Combined.begin(), Combined.end()),
QuasiPIDBase(NextQuasiPID) {