clang
3.9.0
|
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like command line arguments. More...
#include <Driver.h>
Public Types | |
typedef SmallVector < std::string, 4 > | prefix_list |
A prefix directory used to emulate a limited subset of GCC's '-Bprefix' functionality. More... | |
typedef SmallVector< std::pair < types::ID, const llvm::opt::Arg * >, 16 > | InputList |
A list of inputs and their types for the given arguments. More... | |
Public Member Functions | |
DiagnosticBuilder | Diag (unsigned DiagID) const |
bool | CCCIsCXX () const |
Whether the driver should follow g++ like behavior. More... | |
bool | CCCIsCPP () const |
Whether the driver is just the preprocessor. More... | |
bool | IsCLMode () const |
Whether the driver should follow cl.exe like behavior. More... | |
Driver (StringRef ClangExecutable, StringRef DefaultTargetTriple, DiagnosticsEngine &Diags, IntrusiveRefCntPtr< vfs::FileSystem > VFS=nullptr) | |
~Driver () | |
Accessors | |
const std::string & | getCCCGenericGCCName () const |
Name to use when invoking gcc/g++. More... | |
const llvm::opt::OptTable & | getOpts () const |
const DiagnosticsEngine & | getDiags () const |
vfs::FileSystem & | getVFS () const |
bool | getCheckInputsExist () const |
void | setCheckInputsExist (bool Value) |
const std::string & | getTitle () |
void | setTitle (std::string Value) |
const char * | getClangProgramPath () const |
Get the path to the main clang executable. More... | |
const char * | getInstalledDir () const |
Get the path to where the clang executable was installed. More... | |
void | setInstalledDir (StringRef Value) |
bool | isSaveTempsEnabled () const |
bool | isSaveTempsObj () const |
bool | embedBitcodeEnabled () const |
bool | embedBitcodeMarkerOnly () const |
Primary Functionality | |
void | CreateOffloadingDeviceToolChains (Compilation &C, InputList &Inputs) |
CreateOffloadingDeviceToolChains - create all the toolchains required to support offloading devices given the programming models specified in the current compilation. More... | |
Compilation * | BuildCompilation (ArrayRef< const char * > Args) |
BuildCompilation - Construct a compilation object for a command line argument vector. More... | |
Driver Steps | |
void | ParseDriverMode (ArrayRef< const char * > Args) |
ParseDriverMode - Look for and handle the driver mode option in Args. More... | |
llvm::opt::InputArgList | ParseArgStrings (ArrayRef< const char * > Args) |
ParseArgStrings - Parse the given list of strings into an ArgList. More... | |
void | BuildInputs (const ToolChain &TC, llvm::opt::DerivedArgList &Args, InputList &Inputs) const |
BuildInputs - Construct the list of inputs and their types from the given arguments. More... | |
void | BuildActions (Compilation &C, llvm::opt::DerivedArgList &Args, const InputList &Inputs, ActionList &Actions) const |
BuildActions - Construct the list of actions to perform for the given arguments, which are only done for a single architecture. More... | |
void | BuildUniversalActions (Compilation &C, const ToolChain &TC, const InputList &BAInputs) const |
BuildUniversalActions - Construct the list of actions to perform for the given arguments, which may require a universal build. More... | |
void | BuildJobs (Compilation &C) const |
BuildJobs - Bind actions to concrete tools and translate arguments to form the list of jobs to run. More... | |
int | ExecuteCompilation (Compilation &C, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands) |
ExecuteCompilation - Execute the compilation according to the command line arguments and return an appropriate exit code. More... | |
void | generateCompilationDiagnostics (Compilation &C, const Command &FailingCommand) |
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(s). More... | |
Static Public Member Functions | |
static bool | GetReleaseVersion (const char *Str, unsigned &Major, unsigned &Minor, unsigned &Micro, bool &HadExtra) |
GetReleaseVersion - Parse (([0-9]+)(. More... | |
static bool | GetReleaseVersion (const char *Str, MutableArrayRef< unsigned > Digits) |
Parse digits from a string Str and fulfill Digits with the parsed numbers. More... | |
Public Attributes | |
std::string | Name |
The name the driver was invoked as. More... | |
std::string | Dir |
The path the driver executable was in, as invoked from the command line. More... | |
std::string | ClangExecutable |
The original path to the clang executable. More... | |
std::string | InstalledDir |
The path to the installed clang directory, if any. More... | |
std::string | ResourceDir |
The path to the compiler resource directory. More... | |
prefix_list | PrefixDirs |
std::string | SysRoot |
sysroot, if present More... | |
std::string | DyldPrefix |
Dynamic loader prefix, if present. More... | |
bool | UseStdLib |
If the standard library is used. More... | |
std::string | DefaultTargetTriple |
Default target triple. More... | |
std::string | DriverTitle |
Driver title to use with help. More... | |
std::string | HostBits |
Information about the host which can be overridden by the user. More... | |
std::string | HostMachine |
std::string | HostSystem |
std::string | HostRelease |
const char * | CCPrintOptionsFilename |
The file to log CC_PRINT_OPTIONS output to, if enabled. More... | |
const char * | CCPrintHeadersFilename |
The file to log CC_PRINT_HEADERS output to, if enabled. More... | |
const char * | CCLogDiagnosticsFilename |
The file to log CC_LOG_DIAGNOSTICS output to, if enabled. More... | |
unsigned | CCCPrintBindings: 1 |
Only print tool bindings, don't build any jobs. More... | |
unsigned | CCPrintOptions: 1 |
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to stderr. More... | |
unsigned | CCPrintHeaders: 1 |
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHeadersFilename or to stderr. More... | |
unsigned | CCLogDiagnostics: 1 |
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename or to stderr, in a stable machine readable format. More... | |
unsigned | CCGenDiagnostics: 1 |
Whether the driver is generating diagnostics for debugging purposes. More... | |
unsigned | CCCUsePCH: 1 |
Use lazy precompiled headers for PCH support. More... | |
Helper Methods | |
void | PrintActions (const Compilation &C) const |
PrintActions - Print the list of actions. More... | |
void | PrintHelp (bool ShowHidden) const |
PrintHelp - Print the help text. More... | |
void | PrintVersion (const Compilation &C, raw_ostream &OS) const |
PrintVersion - Print the driver version. More... | |
std::string | GetFilePath (const char *Name, const ToolChain &TC) const |
GetFilePath - Lookup Name in the list of file search paths. More... | |
std::string | GetProgramPath (const char *Name, const ToolChain &TC) const |
GetProgramPath - Lookup Name in the list of program search paths. More... | |
bool | HandleImmediateArgs (const Compilation &C) |
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding tools. More... | |
Action * | ConstructPhaseAction (Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase, Action *Input) const |
ConstructAction - Construct the appropriate action to do for Phase on the Input , taking in to account arguments like -fsyntax-only or –analyze. More... | |
InputInfo | BuildJobsForAction (Compilation &C, const Action *A, const ToolChain *TC, const char *BoundArch, bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput, std::map< std::pair< const Action *, std::string >, InputInfo > &CachedResults, bool BuildForOffloadDevice) const |
BuildJobsForAction - Construct the jobs to perform for the action A and return an InputInfo for the result of running A . More... | |
const char * | getDefaultImageName () const |
Returns the default name for linked images (e.g., "a.out"). More... | |
const char * | GetNamedOutputPath (Compilation &C, const JobAction &JA, const char *BaseInput, const char *BoundArch, bool AtTopLevel, bool MultipleArchs, StringRef NormalizedTriple) const |
GetNamedOutputPath - Return the name to use for the output of the action JA . More... | |
std::string | GetTemporaryPath (StringRef Prefix, const char *Suffix) const |
GetTemporaryPath - Return the pathname of a temporary file to use as part of compilation; the file will have the given prefix and suffix. More... | |
std::string | GetClPchPath (Compilation &C, StringRef BaseName) const |
Return the pathname of the pch file in clang-cl mode. More... | |
bool | ShouldUseClangCompiler (const JobAction &JA) const |
ShouldUseClangCompiler - Should the clang compiler be used to handle this action. More... | |
bool | isUsingLTO () const |
Returns true if we are performing any kind of LTO. More... | |
LTOKind | getLTOMode () const |
Get the specific kind of LTO being performed. More... | |
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like command line arguments.
typedef SmallVector<std::pair<types::ID, const llvm::opt::Arg *>, 16> clang::driver::Driver::InputList |
typedef SmallVector<std::string, 4> clang::driver::Driver::prefix_list |
Driver::Driver | ( | StringRef | ClangExecutable, |
StringRef | DefaultTargetTriple, | ||
DiagnosticsEngine & | Diags, | ||
IntrusiveRefCntPtr< vfs::FileSystem > | VFS = nullptr |
||
) |
Definition at line 51 of file Driver.cpp.
References CLANG_VERSION_STRING, Dir, clang::vfs::getRealFileSystem(), InstalledDir, Name, P, and ResourceDir.
Driver::~Driver | ( | ) |
Definition at line 86 of file Driver.cpp.
void Driver::BuildActions | ( | Compilation & | C, |
llvm::opt::DerivedArgList & | Args, | ||
const InputList & | Inputs, | ||
ActionList & | Actions | ||
) | const |
BuildActions - Construct the list of actions to perform for the given arguments, which are only done for a single architecture.
C | - The compilation that is being built. |
Args | - The input arguments. |
Actions | - The list to store the resulting actions onto. |
Definition at line 1518 of file Driver.cpp.
References clang::driver::phases::Assemble, buildCudaActions(), CCCIsCPP(), clang::driver::phases::Compile, ConstructPhaseAction(), Current, Diag(), clang::driver::types::getCompilationPhases(), clang::driver::phases::getPhaseName(), clang::driver::types::getPreprocessedType(), clang::driver::Action::getType(), I, clang::driver::phases::Link, clang::driver::Compilation::MakeAction(), MakeInputArg(), clang::driver::Action::OFK_Cuda, clang::driver::phases::Preprocess, clang::driver::Action::propagateHostOffloadInfo(), and clang::driver::types::TY_INVALID.
Referenced by BuildCompilation(), buildCudaActions(), BuildUniversalActions(), and generateCompilationDiagnostics().
Compilation * Driver::BuildCompilation | ( | ArrayRef< const char * > | Args | ) |
BuildCompilation - Construct a compilation object for a command line argument vector.
Definition at line 453 of file Driver.cpp.
References BuildActions(), BuildInputs(), BuildJobs(), BuildUniversalActions(), CCCPrintBindings, CCCUsePCH, computeTargetTriple(), CreateOffloadingDeviceToolChains(), DefaultTargetTriple, Dir, DyldPrefix, clang::driver::Compilation::getActions(), clang::driver::Compilation::getArgs(), clang::driver::Compilation::getDefaultToolChain(), getLTOMode(), clang::driver::ToolChain::getTriple(), HandleImmediateArgs(), InstalledDir, IsCLMode(), clang::driver::LTOK_None, Name, ParseArgStrings(), ParseDriverMode(), PrefixDirs, PrintActions(), clang::DiagnosticsEngine::Report(), ResourceDir, clang::DiagnosticsEngine::setIgnoreAllWarnings(), SysRoot, and UseStdLib.
Referenced by clang::createInvocationFromCommandLine().
void Driver::BuildInputs | ( | const ToolChain & | TC, |
llvm::opt::DerivedArgList & | Args, | ||
InputList & | Inputs | ||
) | const |
BuildInputs - Construct the list of inputs and their types from the given arguments.
TC | - The default host tool chain. |
Args | - The input arguments. |
Inputs | - The list to store the resulting compilation inputs onto. |
Definition at line 1238 of file Driver.cpp.
References CCCIsCPP(), CCCIsCXX(), Diag(), DiagnoseInputExistence(), clang::driver::types::getTypeName(), IsCLMode(), clang::driver::options::LinkerInput, clang::driver::types::lookupCXXTypeForCType(), clang::driver::ToolChain::LookupTypeForExtension(), clang::driver::types::lookupTypeForTypeSpecifier(), MakeInputArg(), Previous, and clang::driver::types::TY_INVALID.
Referenced by BuildCompilation(), and generateCompilationDiagnostics().
void Driver::BuildJobs | ( | Compilation & | C | ) | const |
BuildJobs - Bind actions to concrete tools and translate arguments to form the list of jobs to run.
C | - The compilation that is being built. |
Definition at line 1847 of file Driver.cpp.
References BuildJobsForAction(), Diag(), clang::driver::Compilation::getActions(), clang::driver::Compilation::getArgs(), getDefaultImageName(), clang::driver::Compilation::getDefaultToolChain(), clang::driver::ToolChain::getTriple(), clang::DiagnosticsEngine::hasErrorOccurred(), IsCLMode(), and clang::driver::options::NoArgumentUnused.
Referenced by BuildCompilation(), and generateCompilationDiagnostics().
InputInfo Driver::BuildJobsForAction | ( | Compilation & | C, |
const Action * | A, | ||
const ToolChain * | TC, | ||
const char * | BoundArch, | ||
bool | AtTopLevel, | ||
bool | MultipleArchs, | ||
const char * | LinkingOutput, | ||
std::map< std::pair< const Action *, std::string >, InputInfo > & | CachedResults, | ||
bool | BuildForOffloadDevice | ||
) | const |
BuildJobsForAction - Construct the jobs to perform for the action A
and return an InputInfo for the result of running A
.
Will only construct jobs for a given (Action, ToolChain, BoundArch) tuple once.
Definition at line 2082 of file Driver.cpp.
References clang::driver::ToolChain::getTriple(), and clang::Result.
Referenced by BuildJobs().
void Driver::BuildUniversalActions | ( | Compilation & | C, |
const ToolChain & | TC, | ||
const InputList & | BAInputs | ||
) | const |
BuildUniversalActions - Construct the list of actions to perform for the given arguments, which may require a universal build.
C | - The compilation that is being built. |
TC | - The default host tool chain. |
Definition at line 1110 of file Driver.cpp.
References BuildActions(), clang::driver::types::canLipoType(), ContainsCompileOrAssembleAction(), Diag(), clang::driver::Compilation::getActions(), clang::driver::tools::darwin::getArchTypeForMachOArchName(), clang::driver::Compilation::getArgs(), clang::driver::ToolChain::getDefaultUniversalArchName(), clang::driver::types::getTypeName(), and clang::driver::Compilation::MakeAction().
Referenced by BuildCompilation(), and generateCompilationDiagnostics().
|
inline |
Whether the driver is just the preprocessor.
Definition at line 161 of file Driver.h.
Referenced by BuildActions(), BuildInputs(), and CheckPreprocessingOptions().
|
inline |
Whether the driver should follow g++ like behavior.
Definition at line 158 of file Driver.h.
Referenced by AddLibgcc(), BuildInputs(), ConstructGoldLinkJob(), constructHexagonLinkArgs(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::wasm::Linker::ConstructJob(), clang::driver::tools::cloudabi::Linker::ConstructJob(), clang::driver::tools::openbsd::Linker::ConstructJob(), clang::driver::tools::bitrig::Linker::ConstructJob(), clang::driver::tools::freebsd::Linker::ConstructJob(), clang::driver::tools::netbsd::Linker::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), clang::driver::tools::nacltools::Linker::ConstructJob(), clang::driver::tools::minix::Linker::ConstructJob(), clang::driver::tools::dragonfly::Linker::ConstructJob(), clang::driver::tools::MinGW::Linker::ConstructJob(), clang::driver::tools::CrossWindows::Linker::ConstructJob(), clang::driver::tools::Myriad::Linker::ConstructJob(), and clang::driver::SanitizerArgs::SanitizerArgs().
Action * Driver::ConstructPhaseAction | ( | Compilation & | C, |
const llvm::opt::ArgList & | Args, | ||
phases::ID | Phase, | ||
Action * | Input | ||
) | const |
ConstructAction - Construct the appropriate action to do for Phase
on the Input
, taking in to account arguments like -fsyntax-only or –analyze.
Definition at line 1776 of file Driver.cpp.
References clang::driver::phases::Assemble, clang::driver::phases::Backend, CCGenDiagnostics, clang::driver::phases::Compile, clang::driver::types::getPreprocessedType(), clang::driver::Action::getType(), Input, isUsingLTO(), clang::driver::phases::Link, clang::driver::Compilation::MakeAction(), clang::driver::phases::Precompile, clang::driver::phases::Preprocess, and clang::driver::types::TY_INVALID.
Referenced by BuildActions().
void Driver::CreateOffloadingDeviceToolChains | ( | Compilation & | C, |
InputList & | Inputs | ||
) |
CreateOffloadingDeviceToolChains - create all the toolchains required to support offloading devices given the programming models specified in the current compilation.
Also, update the host tool chain kind accordingly.
Definition at line 426 of file Driver.cpp.
References clang::driver::Compilation::addOffloadDeviceToolChain(), clang::driver::Compilation::getInputArgs(), clang::driver::Compilation::getSingleOffloadToolChain(), I, clang::driver::types::isCuda(), clang::driver::Action::OFK_Cuda, and clang::driver::Action::OFK_Host.
Referenced by BuildCompilation().
|
inline |
Definition at line 97 of file Driver.h.
References clang::DiagnosticsEngine::Report().
Referenced by clang::driver::SanitizerArgs::addArgs(), clang::driver::toolchains::Linux::AddCudaIncludeArgs(), addExceptionArgs(), AddLinkerInputs(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLibArgs(), addPGOAndCoverageFlags(), AddRunTimeLibs(), BuildActions(), clang::driver::toolchains::MSVCToolChain::buildAssembler(), buildCudaActions(), BuildInputs(), BuildJobs(), BuildUniversalActions(), checkARMArchName(), checkARMCPUName(), CheckCodeGenerationOptions(), clang::driver::toolchains::Darwin::CheckObjCARC(), CheckPreprocessingOptions(), clang::driver::Compilation::CleanupFile(), CollectArgsForIntegratedAssembler(), computeTargetTriple(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::hexagon::Assembler::ConstructJob(), clang::driver::tools::nacltools::Linker::ConstructJob(), clang::driver::tools::MinGW::Linker::ConstructJob(), clang::driver::tools::PS4cpu::Link::ConstructJob(), DecodeAArch64Features(), DiagnoseInputExistence(), clang::driver::FallbackCommand::Execute(), clang::driver::Compilation::ExecuteCommand(), ExecuteCompilation(), generateCompilationDiagnostics(), getAArch64TargetFeatures(), getAMDGPUTargetFeatures(), getARMFPUFeatures(), getARMHWDivFeatures(), getARMTargetFeatures(), clang::driver::ToolChain::GetCXXStdlibType(), clang::driver::toolchains::MipsLLVMToolChain::GetCXXStdlibType(), clang::driver::toolchains::HexagonToolChain::GetCXXStdlibType(), clang::driver::toolchains::NaClToolChain::GetCXXStdlibType(), clang::driver::ToolChain::GetLinkerPath(), getMipsFloatABI(), getMIPSTargetFeatures(), clang::driver::tools::visualstudio::getMSVCVersion(), getOpenMPRuntime(), getPPCTargetFeatures(), getRefinementStep(), clang::driver::ToolChain::GetRuntimeLibType(), GetTemporaryPath(), getX86TargetFeatures(), clang::driver::toolchains::MyriadToolChain::MyriadToolChain(), ParseArgStrings(), parseArgValues(), parseClangCLEHFlags(), parseCoverageFeatures(), ParseDriverMode(), ParseMRecip(), ParsePICArgs(), parseSanitizeTrapArgs(), clang::driver::toolchains::PS4CPU::PS4CPU(), clang::driver::tools::gcc::Compiler::RenderExtraToolArgs(), clang::driver::SanitizerArgs::SanitizerArgs(), clang::driver::ToolChain::ToolChain(), clang::driver::toolchains::MachO::TranslateArgs(), clang::driver::toolchains::Darwin::TranslateArgs(), and clang::driver::toolchains::CudaToolChain::TranslateArgs().
|
inline |
Definition at line 271 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
|
inline |
Definition at line 272 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
int Driver::ExecuteCompilation | ( | Compilation & | C, |
SmallVectorImpl< std::pair< int, const Command * > > & | FailingCommands | ||
) |
ExecuteCompilation - Execute the compilation according to the command line arguments and return an appropriate exit code.
This routine handles additional processing that must be done in addition to just running the subprocesses, for example reporting errors, setting up response files, removing temporary files, etc.
Definition at line 790 of file Driver.cpp.
References clang::driver::Compilation::CleanupFileList(), clang::driver::Compilation::CleanupFileMap(), Diag(), clang::driver::Compilation::ExecuteJobs(), clang::driver::Compilation::getArgs(), clang::driver::Command::getCreator(), clang::driver::Compilation::getFailureResultFiles(), clang::driver::Compilation::getJobs(), clang::driver::Compilation::getResultFiles(), clang::driver::Tool::getShortName(), clang::driver::Command::getSource(), clang::driver::Compilation::getTempFiles(), clang::DiagnosticsEngine::hasErrorOccurred(), clang::driver::Tool::hasGoodDiagnostics(), isSaveTempsEnabled(), and clang::driver::JobList::Print().
void Driver::generateCompilationDiagnostics | ( | Compilation & | C, |
const Command & | FailingCommand | ||
) |
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(s).
Definition at line 616 of file Driver.cpp.
References BuildActions(), BuildInputs(), BuildJobs(), BuildUniversalActions(), CCGenDiagnostics, clang::driver::Compilation::CleanupFileList(), Diag(), clang::driver::Compilation::ExecuteJobs(), clang::driver::CrashReportInfo::Filename, clang::driver::Compilation::getActions(), clang::driver::Compilation::getArgs(), clang::getClangFullVersion(), clang::driver::Command::getCreator(), clang::driver::Compilation::getDefaultToolChain(), clang::driver::Compilation::getInputArgs(), clang::driver::Compilation::getJobs(), clang::driver::types::getPreprocessedType(), clang::driver::Compilation::getTempFiles(), clang::driver::ToolChain::getTriple(), clang::DiagnosticErrorTrap::hasErrorOccurred(), clang::driver::Compilation::initCompilationForDiagnostics(), clang::driver::Tool::isDsymutilJob(), clang::driver::Tool::isLinkJob(), isSaveTempsEnabled(), clang::driver::Command::Print(), printArgList(), PrintVersion(), and clang::driver::types::TY_INVALID.
|
inline |
Name to use when invoking gcc/g++.
Definition at line 238 of file Driver.h.
Referenced by clang::driver::tools::gcc::Common::ConstructJob().
|
inline |
Definition at line 246 of file Driver.h.
Referenced by DiagnoseInputExistence().
|
inline |
Get the path to the main clang executable.
Definition at line 254 of file Driver.h.
References ClangExecutable.
Referenced by clang::driver::tools::visualstudio::Linker::ConstructJob(), and clang::driver::tools::visualstudio::Compiler::GetCommand().
std::string Driver::GetClPchPath | ( | Compilation & | C, |
StringRef | BaseName | ||
) | const |
Return the pathname of the pch file in clang-cl mode.
Definition at line 2579 of file Driver.cpp.
References clang::driver::Compilation::getArgs().
Referenced by GetNamedOutputPath().
const char * Driver::getDefaultImageName | ( | ) | const |
Returns the default name for linked images (e.g., "a.out").
Definition at line 2276 of file Driver.cpp.
References DefaultTargetTriple, and normalize().
Referenced by BuildJobs(), and GetNamedOutputPath().
|
inline |
Definition at line 242 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
std::string Driver::GetFilePath | ( | const char * | Name, |
const ToolChain & | TC | ||
) | const |
GetFilePath - Lookup Name
in the list of file search paths.
TC | - The tool chain for additional information on directories to search. |
Definition at line 2479 of file Driver.cpp.
References Dir, clang::driver::ToolChain::getFilePaths(), Name, P, PrefixDirs, ResourceDir, and SysRoot.
Referenced by clang::driver::ToolChain::GetFilePath(), and HandleImmediateArgs().
|
inline |
Get the path to where the clang executable was installed.
Definition at line 259 of file Driver.h.
References Dir, and InstalledDir.
Referenced by clang::driver::toolchains::MipsLLVMToolChain::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::MipsLLVMToolChain::AddClangSystemIncludeArgs(), clang::driver::toolchains::HexagonToolChain::AddClangSystemIncludeArgs(), clang::driver::toolchains::HexagonToolChain::getHexagonLibraryPaths(), and clang::driver::toolchains::HexagonToolChain::HexagonToolChain().
|
inline |
Get the specific kind of LTO being performed.
Definition at line 442 of file Driver.h.
Referenced by BuildCompilation(), clang::driver::tools::cloudabi::Linker::ConstructJob(), clang::driver::tools::freebsd::Linker::ConstructJob(), and clang::driver::tools::gnutools::Linker::ConstructJob().
const char * Driver::GetNamedOutputPath | ( | Compilation & | C, |
const JobAction & | JA, | ||
const char * | BaseInput, | ||
const char * | BoundArch, | ||
bool | AtTopLevel, | ||
bool | MultipleArchs, | ||
StringRef | NormalizedTriple | ||
) | const |
GetNamedOutputPath - Return the name to use for the output of the action JA
.
The result is appended to the compilation's list of temporary or result files, as appropriate.
C | - The compilation. |
JA | - The action of interest. |
BaseInput | - The original input file that this action was triggered by. |
BoundArch | - The bound architecture. |
AtTopLevel | - Whether this is a "top-level" action. |
MultipleArchs | - Whether multiple -arch options were supplied. |
NormalizedTriple | - The normalized triple of the relevant target. |
Definition at line 2314 of file Driver.cpp.
References clang::driver::Compilation::addResultFile(), clang::driver::Compilation::addTempFile(), clang::driver::types::appendSuffixForType(), CCGenDiagnostics, End, clang::driver::Compilation::getArgs(), GetClPchPath(), getDefaultImageName(), clang::driver::Action::getOffloadingFileNamePrefix(), GetTemporaryPath(), clang::driver::Action::getType(), clang::driver::types::getTypeTempSuffix(), IsCLMode(), isSaveTempsEnabled(), isSaveTempsObj(), MakeCLOutputFilename(), and Name.
|
inline |
Definition at line 240 of file Driver.h.
Referenced by ParseArgStrings(), ParseDriverMode(), PrintHelp(), clang::driver::toolchains::MachO::TranslateArgs(), clang::driver::toolchains::Darwin::TranslateArgs(), clang::driver::toolchains::CudaToolChain::TranslateArgs(), and clang::driver::toolchains::MSVCToolChain::TranslateArgs().
std::string Driver::GetProgramPath | ( | const char * | Name, |
const ToolChain & | TC | ||
) | const |
GetProgramPath - Lookup Name
in the list of program search paths.
TC | - The provided tool chain for additional information on directories to search. |
Definition at line 2532 of file Driver.cpp.
References clang::driver::ToolChain::getProgramPaths(), Name, P, PrefixDirs, and ScanDirForExecutable().
Referenced by clang::driver::ToolChain::GetProgramPath(), and HandleImmediateArgs().
|
static |
GetReleaseVersion - Parse (([0-9]+)(.
([0-9]+)(.([0-9]+)?))?)? and return the grouped values as integers. Numbers which are not provided are set to 0.
([0-9]+)(.([0-9]+)?))?)? and return the grouped values as integers. Numbers which are not provided are set to 0.
Definition at line 2736 of file Driver.cpp.
References End.
|
static |
Parse digits from a string Str
and fulfill Digits
with the parsed numbers.
This method assumes that the max number of digits to look for is equal to Digits.size().
Definition at line 2775 of file Driver.cpp.
References End.
std::string Driver::GetTemporaryPath | ( | StringRef | Prefix, |
const char * | Suffix | ||
) | const |
GetTemporaryPath - Return the pathname of a temporary file to use as part of compilation; the file will have the given prefix and suffix.
GCC goes to extra lengths here to be a bit more robust.
Definition at line 2567 of file Driver.cpp.
References Diag().
Referenced by GetNamedOutputPath().
|
inline |
Definition at line 250 of file Driver.h.
References DriverTitle.
|
inline |
Definition at line 244 of file Driver.h.
Referenced by clang::driver::toolchains::Linux::AddClangSystemIncludeArgs(), addPathIfExists(), DetectDistro(), findAndroidArmMultilibs(), findBiarchMultilibs(), findMIPSMultilibs(), clang::driver::toolchains::FreeBSD::FreeBSD(), clang::driver::toolchains::HexagonToolChain::getHexagonTargetDir(), getMultiarchTriple(), clang::driver::ToolChain::getVFS(), and clang::driver::toolchains::HexagonToolChain::HexagonToolChain().
bool Driver::HandleImmediateArgs | ( | const Compilation & | C | ) |
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding tools.
Definition at line 897 of file Driver.cpp.
References clang::driver::Multilib::gccSuffix(), clang::driver::Compilation::getArgs(), clang::driver::Compilation::getDefaultToolChain(), GetFilePath(), clang::driver::ToolChain::getFilePaths(), clang::driver::ToolChain::getMultilibs(), GetProgramPath(), clang::driver::ToolChain::getProgramPaths(), clang::driver::Compilation::getSysRoot(), clang::driver::ToolChain::getTripleString(), PrintDiagnosticCategories(), PrintHelp(), clang::driver::ToolChain::printVerboseInfo(), PrintVersion(), and ResourceDir.
Referenced by BuildCompilation().
|
inline |
Whether the driver should follow cl.exe like behavior.
Definition at line 164 of file Driver.h.
Referenced by BuildCompilation(), BuildInputs(), BuildJobs(), CheckPreprocessingOptions(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::visualstudio::Linker::ConstructJob(), DiagnoseInputExistence(), GetNamedOutputPath(), and ParseArgStrings().
|
inline |
Definition at line 268 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob(), ExecuteCompilation(), generateCompilationDiagnostics(), and GetNamedOutputPath().
|
inline |
Definition at line 269 of file Driver.h.
Referenced by GetNamedOutputPath().
|
inline |
Returns true if we are performing any kind of LTO.
Definition at line 439 of file Driver.h.
References clang::driver::LTOK_None.
Referenced by clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::cloudabi::Linker::ConstructJob(), clang::driver::tools::freebsd::Linker::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), ConstructPhaseAction(), and clang::driver::SanitizerArgs::SanitizerArgs().
InputArgList Driver::ParseArgStrings | ( | ArrayRef< const char * > | Args | ) |
ParseArgStrings - Parse the given list of strings into an ArgList.
Definition at line 119 of file Driver.cpp.
References Diag(), getOpts(), IsCLMode(), clang::DiagnosticsEngine::Report(), and clang::driver::options::Unsupported.
Referenced by BuildCompilation().
void Driver::ParseDriverMode | ( | ArrayRef< const char * > | Args | ) |
ParseDriverMode - Look for and handle the driver mode option in Args.
Definition at line 92 of file Driver.cpp.
References Diag(), and getOpts().
Referenced by BuildCompilation().
void Driver::PrintActions | ( | const Compilation & | C | ) | const |
PrintActions - Print the list of actions.
Definition at line 1090 of file Driver.cpp.
References clang::driver::Compilation::getActions(), and PrintActions1().
Referenced by BuildCompilation().
void Driver::PrintHelp | ( | bool | ShowHidden | ) | const |
PrintHelp - Print the help text.
ShowHidden | - Show hidden options. |
Definition at line 854 of file Driver.cpp.
References DriverTitle, getOpts(), Name, and clang::driver::options::NoDriverOption.
Referenced by HandleImmediateArgs().
void Driver::PrintVersion | ( | const Compilation & | C, |
raw_ostream & | OS | ||
) | const |
PrintVersion - Print the driver version.
Definition at line 868 of file Driver.cpp.
References clang::driver::Compilation::getArgs(), clang::getClangFullVersion(), clang::driver::Compilation::getDefaultToolChain(), clang::driver::ToolChain::getThreadModel(), clang::driver::ToolChain::getTripleString(), InstalledDir, and clang::driver::ToolChain::isThreadModelSupported().
Referenced by generateCompilationDiagnostics(), and HandleImmediateArgs().
|
inline |
Definition at line 248 of file Driver.h.
Referenced by clang::createInvocationFromCommandLine().
|
inline |
Definition at line 264 of file Driver.h.
References InstalledDir.
|
inline |
Definition at line 251 of file Driver.h.
References DriverTitle.
Referenced by clang::tooling::newDriver().
ShouldUseClangCompiler - Should the clang compiler be used to handle this action.
Definition at line 2717 of file Driver.cpp.
References clang::driver::Action::input_begin(), clang::driver::types::isAcceptedByClang(), and clang::driver::Action::size().
unsigned clang::driver::Driver::CCCPrintBindings |
Only print tool bindings, don't build any jobs.
Definition at line 167 of file Driver.h.
Referenced by BuildCompilation().
unsigned clang::driver::Driver::CCCUsePCH |
Use lazy precompiled headers for PCH support.
Definition at line 195 of file Driver.h.
Referenced by BuildCompilation(), and clang::driver::tools::Clang::ConstructJob().
unsigned clang::driver::Driver::CCGenDiagnostics |
Whether the driver is generating diagnostics for debugging purposes.
Definition at line 183 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob(), ConstructPhaseAction(), generateCompilationDiagnostics(), and GetNamedOutputPath().
unsigned clang::driver::Driver::CCLogDiagnostics |
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename or to stderr, in a stable machine readable format.
Definition at line 180 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
const char* clang::driver::Driver::CCLogDiagnosticsFilename |
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
Definition at line 151 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
unsigned clang::driver::Driver::CCPrintHeaders |
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHeadersFilename or to stderr.
Definition at line 175 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
const char* clang::driver::Driver::CCPrintHeadersFilename |
The file to log CC_PRINT_HEADERS output to, if enabled.
Definition at line 148 of file Driver.h.
Referenced by clang::driver::tools::Clang::ConstructJob().
unsigned clang::driver::Driver::CCPrintOptions |
const char* clang::driver::Driver::CCPrintOptionsFilename |
std::string clang::driver::Driver::ClangExecutable |
The original path to the clang executable.
Definition at line 111 of file Driver.h.
Referenced by getClangProgramPath().
std::string clang::driver::Driver::DefaultTargetTriple |
Default target triple.
Definition at line 136 of file Driver.h.
Referenced by BuildCompilation(), and getDefaultImageName().
std::string clang::driver::Driver::Dir |
The path the driver executable was in, as invoked from the command line.
Definition at line 108 of file Driver.h.
Referenced by clang::driver::toolchains::NaClToolChain::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::NaClToolChain::AddClangSystemIncludeArgs(), AddGoldPlugin(), BuildCompilation(), clang::driver::tools::visualstudio::Linker::ConstructJob(), Driver(), GetFilePath(), getInstalledDir(), clang::driver::toolchains::Linux::Linux(), and clang::driver::toolchains::PS4CPU::PS4CPU().
std::string clang::driver::Driver::DriverTitle |
Driver title to use with help.
Definition at line 139 of file Driver.h.
Referenced by getTitle(), PrintHelp(), and setTitle().
std::string clang::driver::Driver::DyldPrefix |
Dynamic loader prefix, if present.
Definition at line 130 of file Driver.h.
Referenced by BuildCompilation(), and clang::driver::tools::gnutools::Linker::ConstructJob().
std::string clang::driver::Driver::HostBits |
std::string clang::driver::Driver::InstalledDir |
The path to the installed clang directory, if any.
Definition at line 114 of file Driver.h.
Referenced by clang::driver::toolchains::HexagonToolChain::AddClangCXXStdlibIncludeArgs(), BuildCompilation(), constructHexagonLinkArgs(), Driver(), getInstalledDir(), PrintVersion(), and setInstalledDir().
std::string clang::driver::Driver::Name |
The name the driver was invoked as.
Definition at line 104 of file Driver.h.
Referenced by BuildCompilation(), Driver(), GetFilePath(), GetNamedOutputPath(), GetProgramPath(), and PrintHelp().
prefix_list clang::driver::Driver::PrefixDirs |
Definition at line 124 of file Driver.h.
Referenced by clang::driver::toolchains::HexagonToolChain::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::HexagonToolChain::AddClangSystemIncludeArgs(), BuildCompilation(), constructHexagonLinkArgs(), GetFilePath(), clang::driver::toolchains::HexagonToolChain::getHexagonLibraryPaths(), GetProgramPath(), and clang::driver::toolchains::HexagonToolChain::HexagonToolChain().
std::string clang::driver::Driver::ResourceDir |
The path to the compiler resource directory.
Definition at line 117 of file Driver.h.
Referenced by clang::driver::toolchains::Linux::AddClangSystemIncludeArgs(), clang::driver::toolchains::MipsLLVMToolChain::AddClangSystemIncludeArgs(), clang::driver::toolchains::NaClToolChain::AddClangSystemIncludeArgs(), clang::driver::toolchains::CrossWindowsToolChain::AddClangSystemIncludeArgs(), BuildCompilation(), clang::driver::tools::Clang::ConstructJob(), Driver(), getDefaultBlacklist(), GetFilePath(), and HandleImmediateArgs().
std::string clang::driver::Driver::SysRoot |
sysroot, if present
Definition at line 127 of file Driver.h.
Referenced by clang::driver::toolchains::Bitrig::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::Linux::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::CrossWindowsToolChain::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::CrossWindowsToolChain::AddClangSystemIncludeArgs(), clang::driver::toolchains::MyriadToolChain::AddClangSystemIncludeArgs(), BuildCompilation(), clang::driver::toolchains::Linux::computeSysRoot(), clang::driver::toolchains::MipsLLVMToolChain::computeSysRoot(), ConstructGoldLinkJob(), clang::driver::tools::cloudabi::Linker::ConstructJob(), clang::driver::tools::freebsd::Linker::ConstructJob(), clang::driver::tools::netbsd::Linker::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), clang::driver::tools::nacltools::Linker::ConstructJob(), clang::driver::tools::dragonfly::Linker::ConstructJob(), clang::driver::tools::MinGW::Linker::ConstructJob(), clang::driver::tools::CrossWindows::Linker::ConstructJob(), ConstructPS4LinkJob(), clang::driver::toolchains::CrossWindowsToolChain::CrossWindowsToolChain(), GetFilePath(), clang::driver::Compilation::getSysRoot(), and clang::driver::toolchains::MinGW::MinGW().
bool clang::driver::Driver::UseStdLib |
If the standard library is used.
Definition at line 133 of file Driver.h.
Referenced by BuildCompilation().