10 #ifndef LLVM_CLANG_DRIVER_JOB_H
11 #define LLVM_CLANG_DRIVER_JOB_H
14 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/iterator.h"
17 #include "llvm/Option/Option.h"
32 using llvm::opt::ArgStringList;
39 : Filename(Filename), VFSPath(VFSPath) {}
52 const char *Executable;
56 llvm::opt::ArgStringList Arguments;
59 llvm::opt::ArgStringList InputFilenames;
63 const char *ResponseFile;
67 llvm::opt::ArgStringList InputFileList;
71 std::string ResponseFileFlag;
74 std::vector<const char *> Environment;
86 void writeResponseFile(raw_ostream &OS)
const;
90 const llvm::opt::ArgStringList &Arguments,
97 virtual void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
100 virtual int Execute(
const StringRef **Redirects, std::string *ErrMsg,
101 bool *ExecutionFailed)
const;
115 InputFileList = std::move(List);
126 const llvm::opt::ArgStringList &
getArguments()
const {
return Arguments; }
129 static void printArg(llvm::raw_ostream &OS, StringRef Arg,
bool Quote);
137 const char *Executable_,
const ArgStringList &Arguments_,
139 std::unique_ptr<Command> Fallback_);
141 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
144 int Execute(
const StringRef **Redirects, std::string *ErrMsg,
145 bool *ExecutionFailed)
const override;
148 std::unique_ptr<Command> Fallback;
155 const char *Executable_,
const ArgStringList &Arguments_,
158 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
161 int Execute(
const StringRef **Redirects, std::string *ErrMsg,
162 bool *ExecutionFailed)
const override;
170 typedef llvm::pointee_iterator<list_type::iterator>
iterator;
177 void Print(llvm::raw_ostream &OS,
const char *Terminator,
181 void addJob(std::unique_ptr<Command> J) { Jobs.push_back(std::move(J)); }
188 bool empty()
const {
return Jobs.empty(); }
void setEnvironment(llvm::ArrayRef< const char * > NewEnvironment)
Sets the environment to be used by the new process.
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).
static void printArg(llvm::raw_ostream &OS, StringRef Arg, bool Quote)
Print a command argument, and optionally quote it.
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.
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