10 #ifndef LLVM_CLANG_DRIVER_COMPILATION_H
11 #define LLVM_CLANG_DRIVER_COMPILATION_H
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/Support/Path.h"
45 llvm::opt::InputArgList *Args;
49 llvm::opt::DerivedArgList *TranslatedArgs;
53 std::vector<std::unique_ptr<Action>> AllActions;
64 llvm::DenseMap<std::pair<const ToolChain *, const char *>,
65 llvm::opt::DerivedArgList *> TCArgs;
68 llvm::opt::ArgStringList TempFiles;
78 const StringRef **Redirects;
85 llvm::opt::InputArgList *Args,
86 llvm::opt::DerivedArgList *TranslatedArgs);
94 return CudaDeviceToolChain;
98 CudaHostToolChain = HostToolChain;
101 CudaDeviceToolChain = DeviceToolChain;
106 const llvm::opt::DerivedArgList &
getArgs()
const {
return *TranslatedArgs; }
108 llvm::opt::DerivedArgList &
getArgs() {
return *TranslatedArgs; }
116 template <
typename T,
typename... Args> T *
MakeAction(Args &&... Arg) {
117 T *RawPtr =
new T(std::forward<Args>(Arg)...);
118 AllActions.push_back(std::unique_ptr<Action>(RawPtr));
127 const llvm::opt::ArgStringList &
getTempFiles()
const {
return TempFiles; }
132 return FailureResultFiles;
143 const char *BoundArch);
148 TempFiles.push_back(Name);
155 ResultFiles[JA] =
Name;
162 FailureResultFiles[JA] =
Name;
170 bool CleanupFile(
const char *File,
bool IssueErrors =
false)
const;
177 bool IssueErrors =
false)
const;
187 bool IssueErrors =
false)
const;
202 SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands)
const;
const Driver & getDriver() const
const ArgStringMap & getResultFiles() const
void setCudaDeviceToolChain(const ToolChain *DeviceToolChain)
T * MakeAction(Args &&...Arg)
Creates a new Action owned by this Compilation.
bool CleanupFile(const char *File, bool IssueErrors=false) const
CleanupFile - Delete a given file.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
void setCudaHostToolChain(const ToolChain *HostToolChain)
const llvm::opt::DerivedArgList & getArgs() const
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
const ToolChain * getCudaHostToolChain() const
Compilation(const Driver &D, const ToolChain &DefaultToolChain, llvm::opt::InputArgList *Args, llvm::opt::DerivedArgList *TranslatedArgs)
llvm::opt::DerivedArgList & getArgs()
bool isForDiagnostics() const
Return true if we're compiling for diagnostics.
bool CleanupFileList(const llvm::opt::ArgStringList &Files, bool IssueErrors=false) const
CleanupFileList - Remove the files in the given list.
void addCommand(std::unique_ptr< Command > C)
JobList - A sequence of jobs to perform.
void addJob(std::unique_ptr< Command > J)
Add a job to the list (taking ownership).
llvm::DenseMap< const JobAction *, const char * > ArgStringMap
ArgStringMap - Type used to map a JobAction to its result file.
bool CleanupFileMap(const ArgStringMap &Files, const JobAction *JA, bool IssueErrors=false) const
CleanupFileMap - Remove the files in the given map.
const ToolChain * getCudaDeviceToolChain() const
Command - An executable path/name and argument vector to execute.
const char * addResultFile(const char *Name, const JobAction *JA)
addResultFile - Add a file to remove on failure, and returns its argument.
const llvm::opt::DerivedArgList & getArgsForToolChain(const ToolChain *TC, const char *BoundArch)
getArgsForToolChain - Return the derived argument list for the tool chain TC (or the default tool cha...
const ToolChain & getDefaultToolChain() const
const ArgStringMap & getFailureResultFiles() const
const ActionList & getActions() const
ActionList & getActions()
void ExecuteJobs(const JobList &Jobs, SmallVectorImpl< std::pair< int, const Command * >> &FailingCommands) const
ExecuteJob - Execute a single job.
Compilation - A set of tasks to perform for a single driver invocation.
int ExecuteCommand(const Command &C, const Command *&FailingCommand) const
ExecuteCommand - Execute an actual command.
const llvm::opt::InputArgList & getInputArgs() const
StringRef getSysRoot() const
Returns the sysroot path.
const char * addFailureResultFile(const char *Name, const JobAction *JA)
addFailureResultFile - Add a file to remove if we crash, and returns its argument.
const llvm::opt::ArgStringList & getTempFiles() const
const char * addTempFile(const char *Name)
addTempFile - Add a file to remove on exit, and returns its argument.
const JobList & getJobs() const
void initCompilationForDiagnostics()
initCompilationForDiagnostics - Remove stale state and suppress output so compilation can be reexecut...