blob: 7a4d055159ecafa92e9938fdda400dfc3f415ba1 [file] [log] [blame]
Nick Lewycky6da90772010-12-31 17:31:54 +00001//===--- Job.cpp - Command to Execute -------------------------------------===//
Daniel Dunbar313c2912009-03-13 23:36:33 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Mehdi Amini9670f842016-07-18 19:02:11 +000010#include "clang/Driver/Job.h"
Justin Bognerd3371d82015-07-17 03:35:54 +000011#include "InputInfo.h"
Hans Wennborgc5afd062014-02-18 21:42:51 +000012#include "clang/Driver/Driver.h"
13#include "clang/Driver/DriverDiagnostic.h"
Hans Wennborgc5afd062014-02-18 21:42:51 +000014#include "clang/Driver/Tool.h"
15#include "clang/Driver/ToolChain.h"
Reid Kleckner0290c9c2014-09-15 17:45:39 +000016#include "llvm/ADT/ArrayRef.h"
Chad Rosierbe10f982011-08-02 17:58:04 +000017#include "llvm/ADT/STLExtras.h"
Mehdi Amini9670f842016-07-18 19:02:11 +000018#include "llvm/ADT/SmallString.h"
Hans Wennborgb212b342013-09-12 18:23:34 +000019#include "llvm/ADT/StringRef.h"
Reid Kleckner0290c9c2014-09-15 17:45:39 +000020#include "llvm/ADT/StringSet.h"
Hans Wennborgb212b342013-09-12 18:23:34 +000021#include "llvm/ADT/StringSwitch.h"
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000022#include "llvm/Support/FileSystem.h"
Mehdi Amini9670f842016-07-18 19:02:11 +000023#include "llvm/Support/Path.h"
Hans Wennborge8677ef2013-09-12 18:35:08 +000024#include "llvm/Support/Program.h"
Hans Wennborgb212b342013-09-12 18:23:34 +000025#include "llvm/Support/raw_ostream.h"
Daniel Dunbar313c2912009-03-13 23:36:33 +000026#include <cassert>
27using namespace clang::driver;
Hans Wennborgb212b342013-09-12 18:23:34 +000028using llvm::raw_ostream;
29using llvm::StringRef;
Reid Kleckner0290c9c2014-09-15 17:45:39 +000030using llvm::ArrayRef;
Daniel Dunbar313c2912009-03-13 23:36:33 +000031
Justin Bogner94817612015-07-02 22:52:04 +000032Command::Command(const Action &Source, const Tool &Creator,
Justin Bognerd3371d82015-07-17 03:35:54 +000033 const char *Executable, const ArgStringList &Arguments,
34 ArrayRef<InputInfo> Inputs)
Justin Bogner0cd92482015-07-02 22:52:08 +000035 : Source(Source), Creator(Creator), Executable(Executable),
Justin Bognerd3371d82015-07-17 03:35:54 +000036 Arguments(Arguments), ResponseFile(nullptr) {
37 for (const auto &II : Inputs)
38 if (II.isFilename())
39 InputFilenames.push_back(II.getFilename());
40}
Daniel Dunbar313c2912009-03-13 23:36:33 +000041
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000042/// @brief Check if the compiler flag in question should be skipped when
43/// emitting a reproducer. Also track how many arguments it has and if the
44/// option is some kind of include path.
45static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum,
46 bool &IsInclude) {
47 SkipNum = 2;
Hans Wennborgb212b342013-09-12 18:23:34 +000048 // These flags are all of the form -Flag <Arg> and are treated as two
49 // arguments. Therefore, we need to skip the flag and the next argument.
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000050 bool ShouldSkip = llvm::StringSwitch<bool>(Flag)
Bruno Cardoso Lopesb810b022016-04-04 20:26:57 +000051 .Cases("-MF", "-MT", "-MQ", "-serialize-diagnostic-file", true)
Hans Wennborgb212b342013-09-12 18:23:34 +000052 .Cases("-o", "-coverage-file", "-dependency-file", true)
Bruno Cardoso Lopes7aff2bb2016-12-12 19:28:25 +000053 .Cases("-fdebug-compilation-dir", "-diagnostic-log-file", true)
Justin Bogner61c0e432014-06-22 20:35:10 +000054 .Cases("-dwarf-debug-flags", "-ivfsoverlay", true)
Hans Wennborgb212b342013-09-12 18:23:34 +000055 .Default(false);
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000056 if (ShouldSkip)
57 return true;
Hans Wennborgb212b342013-09-12 18:23:34 +000058
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000059 // Some include flags shouldn't be skipped if we have a crash VFS
60 IsInclude = llvm::StringSwitch<bool>(Flag)
61 .Cases("-include", "-header-include-file", true)
62 .Cases("-idirafter", "-internal-isystem", "-iwithprefix", true)
63 .Cases("-internal-externc-isystem", "-iprefix", true)
64 .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
65 .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
Bruno Cardoso Lopes7aff2bb2016-12-12 19:28:25 +000066 .Cases("-iframework", "-include-pch", true)
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000067 .Default(false);
68 if (IsInclude)
69 return HaveCrashVFS ? false : true;
Hans Wennborgb212b342013-09-12 18:23:34 +000070
71 // The remaining flags are treated as a single argument.
72
73 // These flags are all of the form -Flag and have no second argument.
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000074 ShouldSkip = llvm::StringSwitch<bool>(Flag)
Hans Wennborgb212b342013-09-12 18:23:34 +000075 .Cases("-M", "-MM", "-MG", "-MP", "-MD", true)
76 .Case("-MMD", true)
77 .Default(false);
78
79 // Match found.
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000080 SkipNum = 1;
81 if (ShouldSkip)
82 return true;
Hans Wennborgb212b342013-09-12 18:23:34 +000083
84 // These flags are treated as a single argument (e.g., -F<Dir>).
85 StringRef FlagRef(Flag);
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000086 IsInclude = FlagRef.startswith("-F") || FlagRef.startswith("-I");
87 if (IsInclude)
88 return HaveCrashVFS ? false : true;
89 if (FlagRef.startswith("-fmodules-cache-path="))
90 return true;
Hans Wennborgb212b342013-09-12 18:23:34 +000091
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +000092 SkipNum = 0;
93 return false;
Hans Wennborgb212b342013-09-12 18:23:34 +000094}
95
Mehdi Amini5bf825b2016-10-08 01:38:43 +000096void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
97 const bool Escape = Arg.find_first_of("\"\\$") != StringRef::npos;
Hans Wennborgb212b342013-09-12 18:23:34 +000098
99 if (!Quote && !Escape) {
100 OS << Arg;
101 return;
102 }
103
104 // Quote and escape. This isn't really complete, but good enough.
105 OS << '"';
Mehdi Amini5bf825b2016-10-08 01:38:43 +0000106 for (const char c : Arg) {
Hans Wennborgb212b342013-09-12 18:23:34 +0000107 if (c == '"' || c == '\\' || c == '$')
108 OS << '\\';
109 OS << c;
110 }
111 OS << '"';
112}
113
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000114void Command::writeResponseFile(raw_ostream &OS) const {
115 // In a file list, we only write the set of inputs to the response file
116 if (Creator.getResponseFilesSupport() == Tool::RF_FileList) {
117 for (const char *Arg : InputFileList) {
118 OS << Arg << '\n';
119 }
120 return;
121 }
122
Reid Klecknere2d03442015-07-15 22:42:37 +0000123 // In regular response files, we send all arguments to the response file.
124 // Wrapping all arguments in double quotes ensures that both Unix tools and
125 // Windows tools understand the response file.
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000126 for (const char *Arg : Arguments) {
127 OS << '"';
128
129 for (; *Arg != '\0'; Arg++) {
130 if (*Arg == '\"' || *Arg == '\\') {
131 OS << '\\';
132 }
133 OS << *Arg;
134 }
135
136 OS << "\" ";
137 }
138}
139
140void Command::buildArgvForResponseFile(
141 llvm::SmallVectorImpl<const char *> &Out) const {
142 // When not a file list, all arguments are sent to the response file.
143 // This leaves us to set the argv to a single parameter, requesting the tool
144 // to read the response file.
145 if (Creator.getResponseFilesSupport() != Tool::RF_FileList) {
146 Out.push_back(Executable);
147 Out.push_back(ResponseFileFlag.c_str());
148 return;
149 }
150
151 llvm::StringSet<> Inputs;
152 for (const char *InputName : InputFileList)
153 Inputs.insert(InputName);
154 Out.push_back(Executable);
155 // In a file list, build args vector ignoring parameters that will go in the
156 // response file (elements of the InputFileList vector)
157 bool FirstInput = true;
158 for (const char *Arg : Arguments) {
159 if (Inputs.count(Arg) == 0) {
160 Out.push_back(Arg);
161 } else if (FirstInput) {
162 FirstInput = false;
163 Out.push_back(Creator.getResponseFileFlag());
164 Out.push_back(ResponseFile);
165 }
166 }
167}
168
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +0000169/// @brief Rewrite relative include-like flag paths to absolute ones.
170static void
171rewriteIncludes(const llvm::ArrayRef<const char *> &Args, size_t Idx,
172 size_t NumArgs,
173 llvm::SmallVectorImpl<llvm::SmallString<128>> &IncFlags) {
174 using namespace llvm;
175 using namespace sys;
176 auto getAbsPath = [](StringRef InInc, SmallVectorImpl<char> &OutInc) -> bool {
177 if (path::is_absolute(InInc)) // Nothing to do here...
178 return false;
179 std::error_code EC = fs::current_path(OutInc);
180 if (EC)
181 return false;
182 path::append(OutInc, InInc);
183 return true;
184 };
185
186 SmallString<128> NewInc;
187 if (NumArgs == 1) {
188 StringRef FlagRef(Args[Idx + NumArgs - 1]);
189 assert((FlagRef.startswith("-F") || FlagRef.startswith("-I")) &&
190 "Expecting -I or -F");
191 StringRef Inc = FlagRef.slice(2, StringRef::npos);
192 if (getAbsPath(Inc, NewInc)) {
193 SmallString<128> NewArg(FlagRef.slice(0, 2));
194 NewArg += NewInc;
195 IncFlags.push_back(std::move(NewArg));
196 }
197 return;
198 }
199
200 assert(NumArgs == 2 && "Not expecting more than two arguments");
201 StringRef Inc(Args[Idx + NumArgs - 1]);
202 if (!getAbsPath(Inc, NewInc))
203 return;
204 IncFlags.push_back(SmallString<128>(Args[Idx]));
205 IncFlags.push_back(std::move(NewInc));
206}
207
Hans Wennborgb212b342013-09-12 18:23:34 +0000208void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
Justin Bogner25645152014-10-21 17:24:44 +0000209 CrashReportInfo *CrashInfo) const {
Reid Kleckner822434d2014-08-05 20:49:12 +0000210 // Always quote the exe.
Reid Kleckner4f1fc352014-08-07 00:05:00 +0000211 OS << ' ';
Justin Bognered9cbe02015-07-09 06:58:31 +0000212 printArg(OS, Executable, /*Quote=*/true);
Hans Wennborgb212b342013-09-12 18:23:34 +0000213
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000214 llvm::ArrayRef<const char *> Args = Arguments;
215 llvm::SmallVector<const char *, 128> ArgsRespFile;
216 if (ResponseFile != nullptr) {
217 buildArgvForResponseFile(ArgsRespFile);
218 Args = ArrayRef<const char *>(ArgsRespFile).slice(1); // no executable name
219 }
220
Justin Bogner0cb14752015-03-12 00:52:56 +0000221 bool HaveCrashVFS = CrashInfo && !CrashInfo->VFSPath.empty();
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000222 for (size_t i = 0, e = Args.size(); i < e; ++i) {
223 const char *const Arg = Args[i];
Hans Wennborgb212b342013-09-12 18:23:34 +0000224
Justin Bogner25645152014-10-21 17:24:44 +0000225 if (CrashInfo) {
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +0000226 int NumArgs = 0;
227 bool IsInclude = false;
228 if (skipArgs(Arg, HaveCrashVFS, NumArgs, IsInclude)) {
229 i += NumArgs - 1;
Hans Wennborgb212b342013-09-12 18:23:34 +0000230 continue;
Justin Bognerd3371d82015-07-17 03:35:54 +0000231 }
Bruno Cardoso Lopese3a0aef2016-12-09 02:22:47 +0000232
233 // Relative includes need to be expanded to absolute paths.
234 if (HaveCrashVFS && IsInclude) {
235 SmallVector<SmallString<128>, 2> NewIncFlags;
236 rewriteIncludes(Args, i, NumArgs, NewIncFlags);
237 if (!NewIncFlags.empty()) {
238 for (auto &F : NewIncFlags) {
239 OS << ' ';
240 printArg(OS, F.c_str(), Quote);
241 }
242 i += NumArgs - 1;
243 continue;
244 }
245 }
246
Justin Bognerd3371d82015-07-17 03:35:54 +0000247 auto Found = std::find_if(InputFilenames.begin(), InputFilenames.end(),
248 [&Arg](StringRef IF) { return IF == Arg; });
249 if (Found != InputFilenames.end() &&
250 (i == 0 || StringRef(Args[i - 1]) != "-main-file-name")) {
Justin Bogner25645152014-10-21 17:24:44 +0000251 // Replace the input file name with the crashinfo's file name.
252 OS << ' ';
253 StringRef ShortName = llvm::sys::path::filename(CrashInfo->Filename);
Malcolm Parsonsf76f6502016-11-02 10:39:27 +0000254 printArg(OS, ShortName.str(), Quote);
Justin Bogner25645152014-10-21 17:24:44 +0000255 continue;
Hans Wennborgb212b342013-09-12 18:23:34 +0000256 }
257 }
258
259 OS << ' ';
Justin Bognered9cbe02015-07-09 06:58:31 +0000260 printArg(OS, Arg, Quote);
Hans Wennborgb212b342013-09-12 18:23:34 +0000261 }
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000262
Justin Bogner0cb14752015-03-12 00:52:56 +0000263 if (CrashInfo && HaveCrashVFS) {
Justin Bogner25645152014-10-21 17:24:44 +0000264 OS << ' ';
Justin Bognered9cbe02015-07-09 06:58:31 +0000265 printArg(OS, "-ivfsoverlay", Quote);
Justin Bogner25645152014-10-21 17:24:44 +0000266 OS << ' ';
Malcolm Parsonsf76f6502016-11-02 10:39:27 +0000267 printArg(OS, CrashInfo->VFSPath.str(), Quote);
Bruno Cardoso Lopesf854b042016-04-01 17:39:08 +0000268
Bruno Cardoso Lopes1c108722016-12-09 03:11:48 +0000269 // The leftover modules from the crash are stored in
270 // <name>.cache/vfs/modules
271 // Leave it untouched for pcm inspection and provide a clean/empty dir
272 // path to contain the future generated module cache:
273 // <name>.cache/vfs/repro-modules
Bruno Cardoso Lopesf854b042016-04-01 17:39:08 +0000274 SmallString<128> RelModCacheDir = llvm::sys::path::parent_path(
275 llvm::sys::path::parent_path(CrashInfo->VFSPath));
Bruno Cardoso Lopes1c108722016-12-09 03:11:48 +0000276 llvm::sys::path::append(RelModCacheDir, "repro-modules");
Bruno Cardoso Lopesf854b042016-04-01 17:39:08 +0000277
278 std::string ModCachePath = "-fmodules-cache-path=";
279 ModCachePath.append(RelModCacheDir.c_str());
280
281 OS << ' ';
Malcolm Parsonsf76f6502016-11-02 10:39:27 +0000282 printArg(OS, ModCachePath, Quote);
Justin Bogner25645152014-10-21 17:24:44 +0000283 }
284
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000285 if (ResponseFile != nullptr) {
286 OS << "\n Arguments passed via response file:\n";
287 writeResponseFile(OS);
288 // Avoiding duplicated newline terminator, since FileLists are
289 // newline-separated.
290 if (Creator.getResponseFilesSupport() != Tool::RF_FileList)
291 OS << "\n";
292 OS << " (end of response file)";
293 }
294
Hans Wennborgb212b342013-09-12 18:23:34 +0000295 OS << Terminator;
296}
297
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000298void Command::setResponseFile(const char *FileName) {
299 ResponseFile = FileName;
300 ResponseFileFlag = Creator.getResponseFileFlag();
301 ResponseFileFlag += FileName;
302}
303
Zachary Turnera0f96be2017-03-17 16:24:34 +0000304void Command::setEnvironment(llvm::ArrayRef<const char *> NewEnvironment) {
305 Environment.reserve(NewEnvironment.size() + 1);
306 Environment.assign(NewEnvironment.begin(), NewEnvironment.end());
307 Environment.push_back(nullptr);
308}
309
Hans Wennborge693e842013-09-18 00:41:15 +0000310int Command::Execute(const StringRef **Redirects, std::string *ErrMsg,
Hans Wennborge8677ef2013-09-12 18:35:08 +0000311 bool *ExecutionFailed) const {
312 SmallVector<const char*, 128> Argv;
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000313
Zachary Turnera0f96be2017-03-17 16:24:34 +0000314 const char **Envp;
315 if (Environment.empty()) {
316 Envp = nullptr;
317 } else {
318 assert(Environment.back() == nullptr &&
319 "Environment vector should be null-terminated by now");
320 Envp = const_cast<const char **>(Environment.data());
321 }
322
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000323 if (ResponseFile == nullptr) {
324 Argv.push_back(Executable);
Benjamin Kramerf9890422015-02-17 16:48:30 +0000325 Argv.append(Arguments.begin(), Arguments.end());
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000326 Argv.push_back(nullptr);
327
Zachary Turnera0f96be2017-03-17 16:24:34 +0000328 return llvm::sys::ExecuteAndWait(
329 Executable, Argv.data(), Envp, Redirects, /*secondsToWait*/ 0,
330 /*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000331 }
332
333 // We need to put arguments in a response file (command is too large)
334 // Open stream to store the response file contents
335 std::string RespContents;
336 llvm::raw_string_ostream SS(RespContents);
337
338 // Write file contents and build the Argv vector
339 writeResponseFile(SS);
340 buildArgvForResponseFile(Argv);
Craig Topper92fc2df2014-05-17 16:56:41 +0000341 Argv.push_back(nullptr);
Reid Kleckner0290c9c2014-09-15 17:45:39 +0000342 SS.flush();
343
344 // Save the response file in the appropriate encoding
345 if (std::error_code EC = writeFileWithEncoding(
346 ResponseFile, RespContents, Creator.getResponseFileEncoding())) {
347 if (ErrMsg)
348 *ErrMsg = EC.message();
349 if (ExecutionFailed)
350 *ExecutionFailed = true;
351 return -1;
352 }
Hans Wennborge8677ef2013-09-12 18:35:08 +0000353
Zachary Turnera0f96be2017-03-17 16:24:34 +0000354 return llvm::sys::ExecuteAndWait(Executable, Argv.data(), Envp, Redirects,
355 /*secondsToWait*/ 0,
Hans Wennborge8677ef2013-09-12 18:35:08 +0000356 /*memoryLimit*/ 0, ErrMsg, ExecutionFailed);
357}
358
Hans Wennborg87cfa712013-09-19 20:32:16 +0000359FallbackCommand::FallbackCommand(const Action &Source_, const Tool &Creator_,
360 const char *Executable_,
361 const ArgStringList &Arguments_,
Justin Bognerd3371d82015-07-17 03:35:54 +0000362 ArrayRef<InputInfo> Inputs,
David Blaikiec11bf802014-09-04 16:04:28 +0000363 std::unique_ptr<Command> Fallback_)
Justin Bognerd3371d82015-07-17 03:35:54 +0000364 : Command(Source_, Creator_, Executable_, Arguments_, Inputs),
David Blaikiec11bf802014-09-04 16:04:28 +0000365 Fallback(std::move(Fallback_)) {}
Hans Wennborg87cfa712013-09-19 20:32:16 +0000366
367void FallbackCommand::Print(raw_ostream &OS, const char *Terminator,
Justin Bogner25645152014-10-21 17:24:44 +0000368 bool Quote, CrashReportInfo *CrashInfo) const {
369 Command::Print(OS, "", Quote, CrashInfo);
Hans Wennborg87cfa712013-09-19 20:32:16 +0000370 OS << " ||";
Justin Bogner25645152014-10-21 17:24:44 +0000371 Fallback->Print(OS, Terminator, Quote, CrashInfo);
Hans Wennborg87cfa712013-09-19 20:32:16 +0000372}
373
374static bool ShouldFallback(int ExitCode) {
375 // FIXME: We really just want to fall back for internal errors, such
376 // as when some symbol cannot be mangled, when we should be able to
377 // parse something but can't, etc.
378 return ExitCode != 0;
379}
380
381int FallbackCommand::Execute(const StringRef **Redirects, std::string *ErrMsg,
382 bool *ExecutionFailed) const {
383 int PrimaryStatus = Command::Execute(Redirects, ErrMsg, ExecutionFailed);
384 if (!ShouldFallback(PrimaryStatus))
385 return PrimaryStatus;
386
387 // Clear ExecutionFailed and ErrMsg before falling back.
388 if (ErrMsg)
389 ErrMsg->clear();
390 if (ExecutionFailed)
391 *ExecutionFailed = false;
392
Hans Wennborgc5afd062014-02-18 21:42:51 +0000393 const Driver &D = getCreator().getToolChain().getDriver();
Hans Wennborg897a69b2014-02-19 02:10:19 +0000394 D.Diag(diag::warn_drv_invoking_fallback) << Fallback->getExecutable();
Hans Wennborgc5afd062014-02-18 21:42:51 +0000395
Hans Wennborg87cfa712013-09-19 20:32:16 +0000396 int SecondaryStatus = Fallback->Execute(Redirects, ErrMsg, ExecutionFailed);
397 return SecondaryStatus;
398}
399
Nico Weber2ca4be92016-03-01 23:16:44 +0000400ForceSuccessCommand::ForceSuccessCommand(const Action &Source_,
401 const Tool &Creator_,
402 const char *Executable_,
403 const ArgStringList &Arguments_,
404 ArrayRef<InputInfo> Inputs)
405 : Command(Source_, Creator_, Executable_, Arguments_, Inputs) {}
406
407void ForceSuccessCommand::Print(raw_ostream &OS, const char *Terminator,
408 bool Quote, CrashReportInfo *CrashInfo) const {
409 Command::Print(OS, "", Quote, CrashInfo);
410 OS << " || (exit 0)" << Terminator;
411}
412
413int ForceSuccessCommand::Execute(const StringRef **Redirects,
414 std::string *ErrMsg,
415 bool *ExecutionFailed) const {
416 int Status = Command::Execute(Redirects, ErrMsg, ExecutionFailed);
417 (void)Status;
418 if (ExecutionFailed)
419 *ExecutionFailed = false;
420 return 0;
421}
422
Hans Wennborgb212b342013-09-12 18:23:34 +0000423void JobList::Print(raw_ostream &OS, const char *Terminator, bool Quote,
Justin Bogner25645152014-10-21 17:24:44 +0000424 CrashReportInfo *CrashInfo) const {
Justin Bogneraab97922014-10-03 01:04:53 +0000425 for (const auto &Job : *this)
Justin Bogner25645152014-10-21 17:24:44 +0000426 Job.Print(OS, Terminator, Quote, CrashInfo);
Hans Wennborgb212b342013-09-12 18:23:34 +0000427}
428
David Blaikiec11bf802014-09-04 16:04:28 +0000429void JobList::clear() { Jobs.clear(); }