10 #ifndef LLVM_CLANG_DRIVER_JOB_H
11 #define LLVM_CLANG_DRIVER_JOB_H
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/iterator.h"
16 #include "llvm/Option/Option.h"
31 using llvm::opt::ArgStringList;
38 : Filename(Filename), VFSPath(VFSPath) {}
51 const char *Executable;
55 llvm::opt::ArgStringList Arguments;
58 llvm::opt::ArgStringList InputFilenames;
62 const char *ResponseFile;
66 llvm::opt::ArgStringList InputFileList;
70 std::string ResponseFileFlag;
82 void writeResponseFile(raw_ostream &OS)
const;
86 const llvm::opt::ArgStringList &Arguments,
93 virtual void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
96 virtual int Execute(
const StringRef **Redirects, std::string *ErrMsg,
97 bool *ExecutionFailed)
const;
111 InputFileList = std::move(List);
116 const llvm::opt::ArgStringList &
getArguments()
const {
return Arguments; }
119 static void printArg(llvm::raw_ostream &OS,
const char *Arg,
bool Quote);
127 const char *Executable_,
const ArgStringList &Arguments_,
129 std::unique_ptr<Command> Fallback_);
131 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
134 int Execute(
const StringRef **Redirects, std::string *ErrMsg,
135 bool *ExecutionFailed)
const override;
138 std::unique_ptr<Command> Fallback;
145 const char *Executable_,
const ArgStringList &Arguments_,
148 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
151 int Execute(
const StringRef **Redirects, std::string *ErrMsg,
152 bool *ExecutionFailed)
const override;
160 typedef llvm::pointee_iterator<list_type::iterator>
iterator;
167 void Print(llvm::raw_ostream &OS,
const char *Terminator,
171 void addJob(std::unique_ptr<Command> J) { Jobs.push_back(std::move(J)); }
const char * getExecutable() const
Like Command, but with a fallback which is executed in case the primary command crashes.
void setResponseFile(const char *FileName)
Set to pass arguments via a response file when launching the command.
int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override
llvm::pointee_iterator< list_type::const_iterator > const_iterator
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
Action - Represent an abstract compilation step to perform.
const_iterator begin() const
list_type::size_type size_type
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const Action & getSource() const
getSource - Return the Action which caused the creation of this job.
virtual int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const
JobList - A sequence of jobs to perform.
void addJob(std::unique_ptr< Command > J)
Add a job to the list (taking ownership).
void clear()
Clear the job list.
Command(const Action &Source, const Tool &Creator, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef< InputInfo > Inputs)
Command - An executable path/name and argument vector to execute.
const llvm::opt::ArgStringList & getArguments() const
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const override
SmallVector< std::unique_ptr< Command >, 4 > list_type
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const override
Like Command, but always pretends that the wrapped command succeeded.
static void printArg(llvm::raw_ostream &OS, const char *Arg, bool Quote)
Print a command argument, and optionally quote it.
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
void setInputFileList(llvm::opt::ArgStringList List)
Set an input file list, necessary if we need to use a response file but the tool being called only su...
CrashReportInfo(StringRef Filename, StringRef VFSPath)
const list_type & getJobs() const
ForceSuccessCommand(const Action &Source_, const Tool &Creator_, const char *Executable_, const ArgStringList &Arguments_, ArrayRef< InputInfo > Inputs)
llvm::pointee_iterator< list_type::iterator > iterator
const_iterator end() const
FallbackCommand(const Action &Source_, const Tool &Creator_, const char *Executable_, const ArgStringList &Arguments_, ArrayRef< InputInfo > Inputs, std::unique_ptr< Command > Fallback_)
int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override