|
clang 23.0.0git
|
Compilation - A set of tasks to perform for a single driver invocation. More...
#include "clang/Driver/Compilation.h"
Public Types | |
| using | const_offload_toolchains_iterator |
| Iterator that visits device toolchains of a given kind. | |
| using | const_offload_toolchains_range |
Public Member Functions | |
| Compilation (const Driver &D, const ToolChain &DefaultToolChain, llvm::opt::InputArgList *Args, llvm::opt::DerivedArgList *TranslatedArgs, bool ContainsError) | |
| ~Compilation () | |
| const Driver & | getDriver () const |
| const ToolChain & | getDefaultToolChain () const |
| unsigned | isOffloadingHostKind (Action::OffloadKind Kind) const |
| unsigned | getActiveOffloadKinds () const |
| template<Action::OffloadKind Kind> | |
| const_offload_toolchains_range | getOffloadToolChains () const |
| const_offload_toolchains_range | getOffloadToolChains (Action::OffloadKind Kind) const |
| template<Action::OffloadKind Kind> | |
| bool | hasOffloadToolChain () const |
| Return true if an offloading tool chain of a given kind exists. | |
| template<Action::OffloadKind Kind> | |
| const ToolChain * | getSingleOffloadToolChain () const |
| Return an offload toolchain of the provided kind. | |
| void | addOffloadDeviceToolChain (const ToolChain *DeviceToolChain, Action::OffloadKind OffloadKind) |
| const llvm::opt::InputArgList & | getInputArgs () const |
| const llvm::opt::DerivedArgList & | getArgs () const |
| llvm::opt::DerivedArgList & | getArgs () |
| ActionList & | getActions () |
| const ActionList & | getActions () const |
| template<typename T, typename... Args> | |
| T * | MakeAction (Args &&... Arg) |
| Creates a new Action owned by this Compilation. | |
| JobList & | getJobs () |
| const JobList & | getJobs () const |
| void | addCommand (std::unique_ptr< Command > Cmd) |
| StringRef | getCurrentBoundArch () const |
| void | setCurrentBoundArch (StringRef Arch) |
| llvm::opt::ArgStringList & | getTempFiles () |
| const llvm::opt::ArgStringList & | getTempFiles () const |
| const ArgStringMap & | getResultFiles () const |
| const ArgStringMap & | getFailureResultFiles () const |
| void | setPostCallback (const std::function< void(const Command &, int)> &CB) |
| Installs a handler that is executed when a compilation job is finished. | |
| StringRef | getSysRoot () const |
| Returns the sysroot path. | |
| const llvm::opt::DerivedArgList & | getArgsForToolChain (const ToolChain *TC, StringRef BoundArch, Action::OffloadKind DeviceOffloadKind) |
getArgsForToolChain - Return the derived argument list for the tool chain TC (or the default tool chain, if TC is not specified). | |
| const char * | addTempFile (const char *Name) |
| addTempFile - Add a file to remove on exit, and returns its argument. | |
| const char * | addResultFile (const char *Name, const JobAction *JA) |
| addResultFile - Add a file to remove on failure, and returns its argument. | |
| const char * | addFailureResultFile (const char *Name, const JobAction *JA) |
| addFailureResultFile - Add a file to remove if we crash, and returns its argument. | |
| const char * | getTimeTraceFile (const JobAction *JA) const |
| void | addTimeTraceFile (const char *Name, const JobAction *JA) |
| bool | CleanupFile (const char *File, bool IssueErrors=false) const |
| CleanupFile - Delete a given file. | |
| bool | CleanupFileList (const llvm::opt::ArgStringList &Files, bool IssueErrors=false) const |
| CleanupFileList - Remove the files in the given list. | |
| bool | CleanupFileMap (const ArgStringMap &Files, const JobAction *JA, bool IssueErrors=false) const |
| CleanupFileMap - Remove the files in the given map. | |
| int | ExecuteCommand (const Command &C, const Command *&FailingCommand, bool LogOnly=false) const |
| ExecuteCommand - Execute an actual command. | |
| void | ExecuteJobs (const JobList &Jobs, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands, bool LogOnly=false) const |
| ExecuteJob - Execute a single job. | |
| void | initCompilationForDiagnostics () |
| initCompilationForDiagnostics - Remove stale state and suppress output so compilation can be reexecuted to generate additional diagnostic information (e.g., preprocessed source(s)). | |
| bool | isForDiagnostics () const |
| Return true if we're compiling for diagnostics. | |
| bool | containsError () const |
| Return whether an error during the parsing of the input args. | |
| void | setContainsError () |
| Force driver to fail before toolchain is created. | |
| void | Redirect (ArrayRef< std::optional< StringRef > > Redirects) |
| Redirect - Redirect output of this compilation. | |
Compilation - A set of tasks to perform for a single driver invocation.
Definition at line 45 of file Compilation.h.
Iterator that visits device toolchains of a given kind.
Definition at line 150 of file Compilation.h.
Definition at line 153 of file Compilation.h.
| Compilation::Compilation | ( | const Driver & | D, |
| const ToolChain & | DefaultToolChain, | ||
| llvm::opt::InputArgList * | Args, | ||
| llvm::opt::DerivedArgList * | TranslatedArgs, | ||
| bool | ContainsError ) |
Definition at line 32 of file Compilation.cpp.
References clang::driver::Action::OFK_Host.
| Compilation::~Compilation | ( | ) |
Definition at line 42 of file Compilation.cpp.
References CleanupFileList().
|
inline |
Definition at line 218 of file Compilation.h.
|
inline |
addFailureResultFile - Add a file to remove if we crash, and returns its argument.
Definition at line 274 of file Compilation.h.
|
inline |
Definition at line 186 of file Compilation.h.
References clang::driver::Action::OFK_Host, and clang::driver::Action::OFK_None.
|
inline |
addResultFile - Add a file to remove on failure, and returns its argument.
Definition at line 267 of file Compilation.h.
|
inline |
addTempFile - Add a file to remove on exit, and returns its argument.
Definition at line 260 of file Compilation.h.
|
inline |
Definition at line 282 of file Compilation.h.
CleanupFile - Delete a given file.
| IssueErrors | - Report failures as errors. |
Definition at line 108 of file Compilation.cpp.
References clang::driver::Driver::Diag(), clang::File, and getDriver().
Referenced by CleanupFileList(), and CleanupFileMap().
| bool Compilation::CleanupFileList | ( | const llvm::opt::ArgStringList & | Files, |
| bool | IssueErrors = false ) const |
CleanupFileList - Remove the files in the given list.
| IssueErrors | - Report failures as errors. |
Definition at line 138 of file Compilation.cpp.
References CleanupFile(), clang::File, and clang::Success.
Referenced by initCompilationForDiagnostics(), and ~Compilation().
| bool Compilation::CleanupFileMap | ( | const ArgStringMap & | Files, |
| const JobAction * | JA, | ||
| bool | IssueErrors = false ) const |
CleanupFileMap - Remove the files in the given map.
| JA | - If specified, only delete the files associated with this JobAction. Otherwise, delete all files in the map. |
| IssueErrors | - Report failures as errors. |
Definition at line 146 of file Compilation.cpp.
References CleanupFile(), clang::File, and clang::Success.
|
inline |
Return whether an error during the parsing of the input args.
Definition at line 340 of file Compilation.h.
| int Compilation::ExecuteCommand | ( | const Command & | C, |
| const Command *& | FailingCommand, | ||
| bool | LogOnly = false ) const |
ExecuteCommand - Execute an actual command.
| FailingCommand | - For non-zero results, this will be set to the Command which failed, if any. |
| LogOnly | - When true, only tries to log the command, not actually execute it. |
Definition at line 160 of file Compilation.cpp.
References clang::C, clang::driver::Driver::Diag(), clang::Error, getArgs(), and getDriver().
Referenced by ExecuteJobs().
| void Compilation::ExecuteJobs | ( | const JobList & | Jobs, |
| SmallVectorImpl< std::pair< int, const Command * > > & | FailingCommands, | ||
| bool | LogOnly = false ) const |
ExecuteJob - Execute a single job.
| FailingCommands | - For non-zero results, this will be a vector of failing commands and their associated result code. |
| LogOnly | - When true, only tries to log the command, not actually execute it. |
Definition at line 235 of file Compilation.cpp.
References ActionFailed(), and ExecuteCommand().
|
inline |
Definition at line 203 of file Compilation.h.
Referenced by ignoreExtraCC1Commands().
|
inline |
Definition at line 204 of file Compilation.h.
|
inline |
Definition at line 147 of file Compilation.h.
|
inline |
Definition at line 201 of file Compilation.h.
|
inline |
Definition at line 199 of file Compilation.h.
Referenced by ExecuteCommand().
| const DerivedArgList & Compilation::getArgsForToolChain | ( | const ToolChain * | TC, |
| StringRef | BoundArch, | ||
| Action::OffloadKind | DeviceOffloadKind ) |
getArgsForToolChain - Return the derived argument list for the tool chain TC (or the default tool chain, if TC is not specified).
If a device offloading kind is specified, a translation specific for that kind is performed, if any.
| BoundArch | - The bound architecture name, or 0. |
| DeviceOffloadKind | - The offload device kind that should be used in the translation, if any. |
Definition at line 58 of file Compilation.cpp.
References getSingleOffloadToolChain(), clang::driver::ToolChain::getTriple(), clang::driver::Action::OFK_OpenMP, clang::driver::ToolChain::TranslateArgs(), clang::driver::ToolChain::TranslateOpenMPTargetArgs(), and clang::driver::ToolChain::TranslateXarchArgs().
|
inline |
Definition at line 223 of file Compilation.h.
|
inline |
Definition at line 141 of file Compilation.h.
|
inline |
Definition at line 139 of file Compilation.h.
Referenced by CleanupFile(), ExecuteCommand(), and getSysRoot().
|
inline |
Definition at line 231 of file Compilation.h.
|
inline |
Definition at line 197 of file Compilation.h.
|
inline |
Definition at line 215 of file Compilation.h.
Referenced by clang::tooling::getCC1Arguments(), and ignoreExtraCC1Commands().
|
inline |
Definition at line 216 of file Compilation.h.
|
inline |
Definition at line 158 of file Compilation.h.
Referenced by getSingleOffloadToolChain().
|
inline |
Definition at line 163 of file Compilation.h.
|
inline |
Definition at line 229 of file Compilation.h.
|
inline |
Return an offload toolchain of the provided kind.
Only one is expected to exist.
Definition at line 176 of file Compilation.h.
References getOffloadToolChains().
Referenced by getArgsForToolChain().
| StringRef Compilation::getSysRoot | ( | ) | const |
Returns the sysroot path.
Definition at line 298 of file Compilation.cpp.
References getDriver(), and clang::driver::Driver::SysRoot.
|
inline |
Definition at line 226 of file Compilation.h.
|
inline |
Definition at line 227 of file Compilation.h.
|
inline |
Definition at line 279 of file Compilation.h.
|
inline |
Return true if an offloading tool chain of a given kind exists.
Definition at line 168 of file Compilation.h.
| void Compilation::initCompilationForDiagnostics | ( | ) |
initCompilationForDiagnostics - Remove stale state and suppress output so compilation can be reexecuted to generate additional diagnostic information (e.g., preprocessed source(s)).
Definition at line 255 of file Compilation.cpp.
References CleanupFileList().
|
inline |
Return true if we're compiling for diagnostics.
Definition at line 337 of file Compilation.h.
|
inline |
Definition at line 143 of file Compilation.h.
|
inline |
Creates a new Action owned by this Compilation.
The new Action is not added to the list returned by getActions().
Definition at line 209 of file Compilation.h.
| void Compilation::Redirect | ( | ArrayRef< std::optional< StringRef > > | Redirects | ) |
Redirect - Redirect output of this compilation.
Can only be done once.
| Redirects | - array of optional paths. The array should have a size of three. The inferior process's stdin(0), stdout(1), and stderr(2) will be redirected to the corresponding paths, if provided (not std::nullopt). |
Definition at line 302 of file Compilation.cpp.
|
inline |
Force driver to fail before toolchain is created.
This is necessary when error happens in action builder.
Definition at line 344 of file Compilation.h.
|
inline |
Definition at line 224 of file Compilation.h.
References Arch.
|
inline |
Installs a handler that is executed when a compilation job is finished.
The arguments of the callback specify the compilation job as an instance of class Command and the exit status of the child process executed that job.
Definition at line 239 of file Compilation.h.
References std::function.