Go to the documentation of this file.
9 #ifndef LLVM_CLANG_DRIVER_JOB_H
10 #define LLVM_CLANG_DRIVER_JOB_H
14 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/ADT/Optional.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ADT/iterator.h"
19 #include "llvm/Option/Option.h"
20 #include "llvm/Support/Program.h"
79 return {
RF_None, llvm::sys::WEM_UTF8,
nullptr};
86 return {
RF_Full, llvm::sys::WEM_UTF8,
"@"};
93 return {
RF_Full, llvm::sys::WEM_CurrentCodePage,
"@"};
100 return {
RF_Full, llvm::sys::WEM_UTF16,
"@"};
117 const char *Executable;
121 llvm::opt::ArgStringList Arguments;
127 std::vector<std::string> OutputFilenames;
131 const char *ResponseFile =
nullptr;
135 llvm::opt::ArgStringList InputFileList;
142 std::vector<const char *> Environment;
157 void writeResponseFile(raw_ostream &OS)
const;
175 virtual void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
189 return ResponseSupport;
198 InputFileList = std::move(List);
208 Arguments = std::move(List);
215 const llvm::opt::ArgStringList &
getArguments()
const {
return Arguments; }
220 return OutputFilenames;
237 const llvm::opt::ArgStringList &Arguments,
240 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
244 bool *ExecutionFailed)
const override;
254 const char *Executable_,
255 const llvm::opt::ArgStringList &Arguments_,
259 void Print(llvm::raw_ostream &OS,
const char *Terminator,
bool Quote,
263 bool *ExecutionFailed)
const override;
271 using iterator = llvm::pointee_iterator<list_type::iterator>;
278 void Print(llvm::raw_ostream &OS,
const char *Terminator,
282 void addJob(std::unique_ptr<Command> J) { Jobs.push_back(std::move(J)); }
289 bool empty()
const {
return Jobs.empty(); }
300 #endif // LLVM_CLANG_DRIVER_JOB_H
static constexpr ResponseFileSupport AtFileUTF16()
Command(const Action &Source, const Tool &Creator, ResponseFileSupport ResponseSupport, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef< InputInfo > Inputs, ArrayRef< InputInfo > Outputs=None)
static constexpr ResponseFileSupport AtFileUTF8()
bool PrintInputFilenames
Whether to print the input filenames when executing.
Action - Represent an abstract compilation step to perform.
void replaceArguments(llvm::opt::ArgStringList List)
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
Optional< llvm::sys::ProcessStatistics > getProcessStatistics() const
Use the CC1 tool callback when available, to avoid creating a new process.
virtual int Execute(ArrayRef< Optional< StringRef >> Redirects, std::string *ErrMsg, bool *ExecutionFailed) const
const list_type & getJobs() const
int Execute(ArrayRef< Optional< StringRef >> Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const override
void clear()
Clear the job list.
CC1Command(const Action &Source, const Tool &Creator, ResponseFileSupport ResponseSupport, const char *Executable, const llvm::opt::ArgStringList &Arguments, ArrayRef< InputInfo > Inputs, ArrayRef< InputInfo > Outputs=None)
bool InProcess
Whether the command will be executed in this process or not.
llvm::sys::WindowsEncodingMethod ResponseEncoding
The encoding to use when writing response files on Windows.
const ResponseFileSupport & getResponseFileSupport()
Returns the kind of response file supported by the current invocation.
llvm::pointee_iterator< list_type::const_iterator > const_iterator
CrashReportInfo(StringRef Filename, StringRef VFSPath)
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
static constexpr ResponseFileSupport AtFileCurCP()
void PrintFileNames() const
Optionally print the filenames to be compiled.
Like Command, but always pretends that the wrapped command succeeded.
JobList - A sequence of jobs to perform.
void setEnvironment(llvm::ArrayRef< const char * > NewEnvironment) override
Sets the environment to be used by the new process.
const std::vector< InputInfo > & getInputInfos() const
void setInputFileList(llvm::opt::ArgStringList List)
Set an input file list, necessary if you specified an RF_FileList response file support.
const char * ResponseFlag
What prefix to use for the command-line argument when passing a response file.
ResponseFileKind ResponseKind
The level of support for response files.
Command - An executable path/name and argument vector to execute.
const llvm::opt::ArgStringList & getArguments() const
list_type::size_type size_type
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const override
const std::vector< std::string > & getOutputFilenames() const
void setResponseFile(const char *FileName)
Set to pass arguments via a response file when launching the command.
const Action & getSource() const
getSource - Return the Action which caused the creation of this job.
const char * getExecutable() const
llvm::pointee_iterator< list_type::iterator > iterator
void addJob(std::unique_ptr< Command > J)
Add a job to the list (taking ownership).
const_iterator end() const
void replaceExecutable(const char *Exe)
const_iterator begin() const
virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
ForceSuccessCommand(const Action &Source_, const Tool &Creator_, ResponseFileSupport ResponseSupport, const char *Executable_, const llvm::opt::ArgStringList &Arguments_, ArrayRef< InputInfo > Inputs, ArrayRef< InputInfo > Outputs=None)
virtual void setEnvironment(llvm::ArrayRef< const char * > NewEnvironment)
Sets the environment to be used by the new process.
virtual ~Command()=default
static constexpr ResponseFileSupport None()
Returns a ResponseFileSupport indicating that response files are not supported.
int Execute(ArrayRef< Optional< StringRef >> Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override