clang API Documentation
#include <Compilation.h>
Public Member Functions | |
Compilation (const Driver &D, const ToolChain &DefaultToolChain, llvm::opt::InputArgList *Args, llvm::opt::DerivedArgList *TranslatedArgs) | |
~Compilation () | |
const Driver & | getDriver () const |
const ToolChain & | getDefaultToolChain () const |
const llvm::opt::InputArgList & | getInputArgs () const |
const llvm::opt::DerivedArgList & | getArgs () const |
llvm::opt::DerivedArgList & | getArgs () |
ActionList & | getActions () |
const ActionList & | getActions () const |
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. | |
const llvm::opt::DerivedArgList & | getArgsForToolChain (const ToolChain *TC, const char *BoundArch) |
const char * | addTempFile (const char *Name) |
const char * | addResultFile (const char *Name, const JobAction *JA) |
const char * | addFailureResultFile (const char *Name, const JobAction *JA) |
bool | CleanupFile (const char *File, bool IssueErrors=false) const |
bool | CleanupFileList (const llvm::opt::ArgStringList &Files, bool IssueErrors=false) const |
bool | CleanupFileMap (const ArgStringMap &Files, const JobAction *JA, bool IssueErrors=false) const |
int | ExecuteCommand (const Command &C, const Command *&FailingCommand) const |
void | ExecuteJob (const Job &J, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands) const |
void | initCompilationForDiagnostics () |
bool | isForDiagnostics () |
Return true if we're compiling for diagnostics. |
Compilation - A set of tasks to perform for a single driver invocation.
Definition at line 34 of file Compilation.h.
Compilation::Compilation | ( | const Driver & | D, |
const ToolChain & | DefaultToolChain, | ||
llvm::opt::InputArgList * | Args, | ||
llvm::opt::DerivedArgList * | TranslatedArgs | ||
) |
Definition at line 25 of file Compilation.cpp.
Definition at line 31 of file Compilation.cpp.
void clang::driver::Compilation::addCommand | ( | std::unique_ptr< Command > | C | ) | [inline] |
Definition at line 97 of file Compilation.h.
References clang::driver::JobList::addJob().
Referenced by clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::hexagon::Assemble::ConstructJob(), clang::driver::tools::hexagon::Link::ConstructJob(), clang::driver::tools::darwin::Assemble::ConstructJob(), clang::driver::tools::darwin::Link::ConstructJob(), clang::driver::tools::darwin::Lipo::ConstructJob(), clang::driver::tools::darwin::Dsymutil::ConstructJob(), clang::driver::tools::darwin::VerifyDebug::ConstructJob(), clang::driver::tools::openbsd::Assemble::ConstructJob(), clang::driver::tools::openbsd::Link::ConstructJob(), clang::driver::tools::bitrig::Assemble::ConstructJob(), clang::driver::tools::bitrig::Link::ConstructJob(), clang::driver::tools::freebsd::Assemble::ConstructJob(), clang::driver::tools::freebsd::Link::ConstructJob(), clang::driver::tools::netbsd::Assemble::ConstructJob(), clang::driver::tools::netbsd::Link::ConstructJob(), clang::driver::tools::gnutools::Assemble::ConstructJob(), clang::driver::tools::gnutools::Link::ConstructJob(), clang::driver::tools::minix::Assemble::ConstructJob(), clang::driver::tools::minix::Link::ConstructJob(), clang::driver::tools::solaris::Assemble::ConstructJob(), clang::driver::tools::solaris::Link::ConstructJob(), clang::driver::tools::dragonfly::Assemble::ConstructJob(), clang::driver::tools::dragonfly::Link::ConstructJob(), clang::driver::tools::visualstudio::Link::ConstructJob(), clang::driver::tools::visualstudio::Compile::ConstructJob(), clang::driver::tools::XCore::Assemble::ConstructJob(), clang::driver::tools::XCore::Link::ConstructJob(), clang::driver::tools::CrossWindows::Assemble::ConstructJob(), clang::driver::tools::CrossWindows::Link::ConstructJob(), and SplitDebugInfo().
const char* clang::driver::Compilation::addFailureResultFile | ( | const char * | Name, |
const JobAction * | JA | ||
) | [inline] |
addFailureResultFile - Add a file to remove if we crash, and returns its argument.
Definition at line 133 of file Compilation.h.
const char* clang::driver::Compilation::addResultFile | ( | const char * | Name, |
const JobAction * | JA | ||
) | [inline] |
addResultFile - Add a file to remove on failure, and returns its argument.
Definition at line 126 of file Compilation.h.
Referenced by clang::driver::Driver::GetNamedOutputPath().
const char* clang::driver::Compilation::addTempFile | ( | const char * | Name | ) | [inline] |
addTempFile - Add a file to remove on exit, and returns its argument.
Definition at line 119 of file Compilation.h.
Referenced by clang::driver::tools::Clang::ConstructJob(), and clang::driver::Driver::GetNamedOutputPath().
bool Compilation::CleanupFile | ( | const char * | File, |
bool | IssueErrors = false |
||
) | const |
CleanupFile - Delete a given file.
IssueErrors | - Report failures as errors. |
Definition at line 70 of file Compilation.cpp.
References clang::driver::Driver::Diag(), 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 100 of file Compilation.cpp.
References CleanupFile(), and clang::format::Success.
Referenced by clang::driver::Driver::ExecuteCompilation(), and clang::driver::Driver::generateCompilationDiagnostics().
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 109 of file Compilation.cpp.
References CleanupFile(), and clang::format::Success.
Referenced by clang::driver::Driver::ExecuteCompilation().
int Compilation::ExecuteCommand | ( | const Command & | C, |
const Command *& | FailingCommand | ||
) | const |
ExecuteCommand - Execute an actual command.
FailingCommand | - For non-zero results, this will be set to the Command which failed, if any. |
Definition at line 125 of file Compilation.cpp.
References AttributeLangSupport::C, clang::driver::Driver::Diag(), clang::diag::Error, clang::driver::Command::Execute(), getArgs(), getDriver(), and clang::driver::Command::Print().
Referenced by ExecuteJob().
void Compilation::ExecuteJob | ( | const Job & | J, |
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 195 of file Compilation.cpp.
References AttributeLangSupport::C, ExecuteCommand(), and InputsOk().
Referenced by clang::driver::Driver::ExecuteCompilation(), and clang::driver::Driver::generateCompilationDiagnostics().
ActionList& clang::driver::Compilation::getActions | ( | ) | [inline] |
Definition at line 91 of file Compilation.h.
Referenced by clang::driver::Driver::BuildCompilation(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::PrintActions(), and UseRelaxAll().
const ActionList& clang::driver::Compilation::getActions | ( | ) | const [inline] |
Definition at line 92 of file Compilation.h.
const llvm::opt::DerivedArgList& clang::driver::Compilation::getArgs | ( | ) | const [inline] |
Definition at line 87 of file Compilation.h.
Referenced by clang::driver::Driver::BuildCompilation(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::tools::Clang::ConstructJob(), ExecuteCommand(), clang::driver::Driver::ExecuteCompilation(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::GetNamedOutputPath(), clang::driver::Driver::HandleImmediateArgs(), clang::driver::Driver::PrintVersion(), and SelectToolForJob().
llvm::opt::DerivedArgList& clang::driver::Compilation::getArgs | ( | ) | [inline] |
Definition at line 89 of file Compilation.h.
const DerivedArgList & Compilation::getArgsForToolChain | ( | const ToolChain * | TC, |
const char * | BoundArch | ||
) |
getArgsForToolChain - Return the derived argument list for the tool chain TC
(or the default tool chain, if TC is not specified).
BoundArch | - The bound architecture name, or 0. |
Definition at line 55 of file Compilation.cpp.
References clang::driver::ToolChain::TranslateArgs().
Referenced by clang::driver::Driver::BuildJobsForAction().
const ToolChain& clang::driver::Compilation::getDefaultToolChain | ( | ) | const [inline] |
Definition at line 83 of file Compilation.h.
Referenced by clang::driver::Driver::BuildCompilation(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::Driver::generateCompilationDiagnostics(), clang::driver::Driver::HandleImmediateArgs(), and clang::driver::Driver::PrintVersion().
const Driver& clang::driver::Compilation::getDriver | ( | ) | const [inline] |
Definition at line 81 of file Compilation.h.
Referenced by CleanupFile(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::visualstudio::Link::ConstructJob(), ExecuteCommand(), and getSysRoot().
const ArgStringMap& clang::driver::Compilation::getFailureResultFiles | ( | ) | const [inline] |
Definition at line 103 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation().
const llvm::opt::InputArgList& clang::driver::Compilation::getInputArgs | ( | ) | const [inline] |
Definition at line 85 of file Compilation.h.
JobList& clang::driver::Compilation::getJobs | ( | ) | [inline] |
Definition at line 94 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation(), clang::driver::Driver::generateCompilationDiagnostics(), and clang::tooling::getCC1Arguments().
const JobList& clang::driver::Compilation::getJobs | ( | ) | const [inline] |
Definition at line 95 of file Compilation.h.
const ArgStringMap& clang::driver::Compilation::getResultFiles | ( | ) | const [inline] |
Definition at line 101 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation().
StringRef Compilation::getSysRoot | ( | ) | const |
Returns the sysroot path.
Definition at line 239 of file Compilation.cpp.
References getDriver(), and clang::driver::Driver::SysRoot.
Referenced by clang::driver::Driver::HandleImmediateArgs().
const llvm::opt::ArgStringList& clang::driver::Compilation::getTempFiles | ( | ) | const [inline] |
Definition at line 99 of file Compilation.h.
Referenced by clang::driver::Driver::ExecuteCompilation(), and clang::driver::Driver::generateCompilationDiagnostics().
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 210 of file Compilation.cpp.
References clang::driver::JobList::clear().
Referenced by clang::driver::Driver::generateCompilationDiagnostics().
bool clang::driver::Compilation::isForDiagnostics | ( | ) | [inline] |
Return true if we're compiling for diagnostics.
Definition at line 181 of file Compilation.h.
Referenced by clang::driver::tools::Clang::ConstructJob().