clang
10.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 = const std::multimap< Action::OffloadKind, const ToolChain * >::const_iterator |
Iterator that visits device toolchains of a given kind. More... | |
using | const_offload_toolchains_range = std::pair< const_offload_toolchains_iterator, const_offload_toolchains_iterator > |
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 |
template<Action::OffloadKind Kind> | |
const_offload_toolchains_range | getOffloadToolChains () const |
template<Action::OffloadKind Kind> | |
bool | hasOffloadToolChain () const |
Return true if an offloading tool chain of a given kind exists. More... | |
template<Action::OffloadKind Kind> | |
const ToolChain * | getSingleOffloadToolChain () const |
Return an offload toolchain of the provided kind. More... | |
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. More... | |
JobList & | getJobs () |
const JobList & | getJobs () const |
void | addCommand (std::unique_ptr< Command > C) |
const llvm::opt::ArgStringList & | getTempFiles () const |
const ArgStringMap & | getResultFiles () const |
const ArgStringMap & | getFailureResultFiles () const |
StringRef | getSysRoot () const |
Returns the sysroot path. More... | |
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). More... | |
const char * | addTempFile (const char *Name) |
addTempFile - Add a file to remove on exit, and returns its argument. More... | |
const char * | addResultFile (const char *Name, const JobAction *JA) |
addResultFile - Add a file to remove on failure, and returns its argument. More... | |
const char * | addFailureResultFile (const char *Name, const JobAction *JA) |
addFailureResultFile - Add a file to remove if we crash, and returns its argument. More... | |
bool | CleanupFile (const char *File, bool IssueErrors=false) const |
CleanupFile - Delete a given file. More... | |
bool | CleanupFileList (const llvm::opt::ArgStringList &Files, bool IssueErrors=false) const |
CleanupFileList - Remove the files in the given list. More... | |
bool | CleanupFileMap (const ArgStringMap &Files, const JobAction *JA, bool IssueErrors=false) const |
CleanupFileMap - Remove the files in the given map. More... | |
int | ExecuteCommand (const Command &C, const Command *&FailingCommand) const |
ExecuteCommand - Execute an actual command. More... | |
void | ExecuteJobs (const JobList &Jobs, SmallVectorImpl< std::pair< int, const Command *>> &FailingCommands) const |
ExecuteJob - Execute a single job. More... | |
void | initCompilationForDiagnostics () |
initCompilationForDiagnostics - Remove stale state and suppress output so compilation can be reexecuted to generate additional diagnostic information (e.g., preprocessed source(s)). More... | |
bool | isForDiagnostics () const |
Return true if we're compiling for diagnostics. More... | |
bool | containsError () const |
Return whether an error during the parsing of the input args. More... | |
void | Redirect (ArrayRef< Optional< StringRef >> Redirects) |
Redirect - Redirect output of this compilation. More... | |
Compilation - A set of tasks to perform for a single driver invocation.
Definition at line 45 of file Compilation.h.
using clang::driver::Compilation::const_offload_toolchains_iterator = const std::multimap<Action::OffloadKind, const ToolChain *>::const_iterator |
Iterator that visits device toolchains of a given kind.
Definition at line 144 of file Compilation.h.
using clang::driver::Compilation::const_offload_toolchains_range = std::pair<const_offload_toolchains_iterator, const_offload_toolchains_iterator> |
Definition at line 147 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 36 of file Compilation.cpp.
References clang::driver::Action::OFK_Host.
Compilation::~Compilation | ( | ) |
Definition at line 46 of file Compilation.cpp.
References CleanupFileList(), and clang::driver::Driver::isSaveTempsEnabled().
|
inline |
Definition at line 205 of file Compilation.h.
References clang::driver::JobList::addJob().
Referenced by ConstructGoldLinkJob(), clang::driver::tools::AMDGCN::constructHIPFatbinCommand(), clang::driver::tools::ifstool::Merger::ConstructJob(), clang::driver::tools::fuchsia::Linker::ConstructJob(), clang::driver::tools::amdgpu::Linker::ConstructJob(), clang::driver::tools::wasm::Linker::ConstructJob(), clang::driver::tools::XCore::Assembler::ConstructJob(), clang::driver::tools::minix::Assembler::ConstructJob(), clang::driver::tools::CrossWindows::Assembler::ConstructJob(), clang::driver::tools::SHAVE::Compiler::ConstructJob(), clang::driver::tools::aix::Assembler::ConstructJob(), clang::driver::tools::dragonfly::Assembler::ConstructJob(), clang::driver::tools::freebsd::Assembler::ConstructJob(), clang::driver::tools::MinGW::Assembler::ConstructJob(), clang::driver::tools::cloudabi::Linker::ConstructJob(), clang::driver::tools::netbsd::Assembler::ConstructJob(), clang::driver::tools::openbsd::Assembler::ConstructJob(), clang::driver::tools::solaris::Assembler::ConstructJob(), clang::driver::tools::ananas::Assembler::ConstructJob(), clang::driver::tools::hexagon::Assembler::ConstructJob(), clang::driver::tools::visualstudio::Linker::ConstructJob(), clang::driver::tools::PS4cpu::Assemble::ConstructJob(), clang::driver::tools::Flang::ConstructJob(), clang::driver::tools::nacltools::Linker::ConstructJob(), clang::driver::tools::XCore::Linker::ConstructJob(), clang::driver::tools::SHAVE::Assembler::ConstructJob(), clang::driver::tools::minix::Linker::ConstructJob(), clang::driver::tools::aix::Linker::ConstructJob(), clang::driver::tools::dragonfly::Linker::ConstructJob(), clang::driver::tools::freebsd::Linker::ConstructJob(), clang::driver::tools::netbsd::Linker::ConstructJob(), clang::driver::tools::openbsd::Linker::ConstructJob(), clang::driver::tools::CrossWindows::Linker::ConstructJob(), clang::driver::tools::solaris::Linker::ConstructJob(), clang::driver::tools::ananas::Linker::ConstructJob(), clang::driver::tools::MinGW::Linker::ConstructJob(), clang::driver::tools::hexagon::Linker::ConstructJob(), clang::driver::tools::visualstudio::Compiler::ConstructJob(), clang::driver::tools::AVR::Linker::ConstructJob(), clang::driver::tools::RISCV::Linker::ConstructJob(), clang::driver::tools::gnutools::Assembler::ConstructJob(), clang::driver::tools::Myriad::Linker::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::msp430::Linker::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), clang::driver::tools::baremetal::Linker::ConstructJob(), clang::driver::tools::darwin::Linker::ConstructJob(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::darwin::Lipo::ConstructJob(), clang::driver::tools::NVPTX::Assembler::ConstructJob(), clang::driver::tools::darwin::Dsymutil::ConstructJob(), clang::driver::tools::NVPTX::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::darwin::VerifyDebug::ConstructJob(), clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadWrapper::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJobMultipleOutputs(), and ConstructPS4LinkJob().
|
inline |
addFailureResultFile - Add a file to remove if we crash, and returns its argument.
Definition at line 246 of file Compilation.h.
Referenced by RelocationModelName().
|
inline |
Definition at line 173 of file Compilation.h.
Referenced by clang::driver::Driver::CreateOffloadingDeviceToolChains().
|
inline |
addResultFile - Add a file to remove on failure, and returns its argument.
Definition at line 239 of file Compilation.h.
Referenced by clang::driver::Driver::GetNamedOutputPath().
|
inline |
addTempFile - Add a file to remove on exit, and returns its argument.
Definition at line 232 of file Compilation.h.
Referenced by clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::GetNamedOutputPath(), RenderModulesOptions(), and shouldLinkerNotDedup().
CleanupFile - Delete a given file.
IssueErrors | - Report failures as errors. |
Definition at line 99 of file Compilation.cpp.
References clang::driver::Driver::Diag(), getDriver(), and clang::transformer::remove().
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 129 of file Compilation.cpp.
References CleanupFile().
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 137 of file Compilation.cpp.
References CleanupFile().
Referenced by clang::driver::Driver::ExecuteCompilation().
|
inline |
Return whether an error during the parsing of the input args.
Definition at line 298 of file Compilation.h.
ExecuteCommand - Execute an actual command.
FailingCommand | - For non-zero results, this will be set to the Command which failed, if any. |
Definition at line 151 of file Compilation.cpp.
References clang::driver::Driver::Diag(), clang::driver::Command::Execute(), getArgs(), getDriver(), and clang::driver::Command::Print().
Referenced by ExecuteJobs().
void Compilation::ExecuteJobs | ( | const JobList & | Jobs, |
SmallVectorImpl< std::pair< int, const Command *>> & | FailingCommands | ||
) | const |
ExecuteJob - Execute a single job.
FailingCommands | - For non-zero results, this will be a vector of failing commands and their associated result code. |
Definition at line 223 of file Compilation.cpp.
References ExecuteCommand(), InputsOk(), and clang::driver::Driver::IsCLMode().
Referenced by clang::driver::Driver::ExecuteCompilation(), and clang::driver::Driver::generateCompilationDiagnostics().
|
inline |
Definition at line 190 of file Compilation.h.
Referenced by clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildUniversalActions(), clang::driver::tools::SHAVE::Compiler::ConstructJob(), clang::driver::Driver::generateCompilationDiagnostics(), getCC1Arguments(), clang::driver::Driver::PrintActions(), and UseRelaxAll().
|
inline |
Definition at line 191 of file Compilation.h.
|
inline |
Definition at line 186 of file Compilation.h.
Referenced by addPGOAndCoverageFlags(), addX86AlignBranchArgs(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::Driver::BuildUniversalActions(), clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), ExecuteCommand(), clang::driver::Driver::ExecuteCompilation(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::GetClPchPath(), clang::driver::Driver::GetNamedOutputPath(), clang::driver::Driver::HandleImmediateArgs(), clang::driver::Driver::PrintVersion(), RelocationModelName(), and shouldLinkerNotDedup().
|
inline |
Definition at line 188 of file Compilation.h.
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 62 of file Compilation.cpp.
References clang::driver::ToolChain::getTriple(), clang::driver::Action::OFK_OpenMP, clang::driver::ToolChain::TranslateArgs(), and clang::driver::ToolChain::TranslateOpenMPTargetArgs().
Referenced by clang::driver::Driver::BuildJobsForAction().
|
inline |
Definition at line 135 of file Compilation.h.
Referenced by clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), CollectArgsForIntegratedAssembler(), clang::driver::tools::visualstudio::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::HandleImmediateArgs(), and clang::driver::Driver::PrintVersion().
|
inline |
Definition at line 133 of file Compilation.h.
Referenced by addX86AlignBranchArgs(), clang::driver::Driver::BuildInputs(), CleanupFile(), clang::driver::tools::visualstudio::Linker::ConstructJob(), clang::driver::tools::AMDGCN::Linker::ConstructJob(), clang::driver::tools::Flang::ConstructJob(), clang::driver::tools::Myriad::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), ExecuteCommand(), getSysRoot(), and shouldLinkerNotDedup().
|
inline |
Definition at line 211 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation().
|
inline |
Definition at line 184 of file Compilation.h.
Referenced by clang::driver::Driver::CreateOffloadingDeviceToolChains(), and clang::driver::Driver::generateCompilationDiagnostics().
|
inline |
Definition at line 202 of file Compilation.h.
Referenced by clang::driver::Driver::BuildJobs(), clang::driver::Driver::ExecuteCompilation(), clang::driver::Driver::generateCompilationDiagnostics(), getCC1Arguments(), clang::tooling::ToolInvocation::run(), and shouldLinkerNotDedup().
|
inline |
Definition at line 203 of file Compilation.h.
|
inline |
Definition at line 150 of file Compilation.h.
Referenced by clang::driver::Driver::BuildInputs(), and forAllAssociatedToolChains().
|
inline |
Definition at line 209 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation().
|
inline |
Return an offload toolchain of the provided kind.
Only one is expected to exist.
Definition at line 163 of file Compilation.h.
Referenced by clang::driver::Driver::BuildInputs(), clang::driver::tools::Clang::ConstructJob(), clang::driver::Driver::CreateOffloadingDeviceToolChains(), and forAllAssociatedToolChains().
StringRef Compilation::getSysRoot | ( | ) | const |
Returns the sysroot path.
Definition at line 285 of file Compilation.cpp.
References getDriver(), and clang::driver::Driver::SysRoot.
Referenced by clang::driver::Driver::HandleImmediateArgs(), RelocationModelName(), and shouldLinkerNotDedup().
|
inline |
Definition at line 207 of file Compilation.h.
Referenced by clang::driver::Driver::generateCompilationDiagnostics().
|
inline |
Return true if an offloading tool chain of a given kind exists.
Definition at line 155 of file Compilation.h.
Referenced by clang::driver::Driver::BuildInputs().
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 242 of file Compilation.cpp.
References CleanupFileList(), clang::driver::JobList::clear(), and clang::driver::Driver::isSaveTempsEnabled().
Referenced by clang::driver::Driver::generateCompilationDiagnostics().
|
inline |
Return true if we're compiling for diagnostics.
Definition at line 295 of file Compilation.h.
Referenced by clang::driver::tools::Clang::ConstructJob(), and RenderModulesOptions().
|
inline |
Definition at line 137 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 196 of file Compilation.h.
Referenced by clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildUniversalActions(), and clang::driver::Driver::ConstructPhaseAction().
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 llvm::None). |
Definition at line 289 of file Compilation.cpp.