10 #ifndef LLVM_CLANG_DRIVER_DRIVER_H
11 #define LLVM_CLANG_DRIVER_DRIVER_H
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/StringRef.h"
66 std::unique_ptr<llvm::opt::OptTable> Opts;
85 enum BitcodeEmbedMode {
117 return Diags.
Report(DiagID);
180 bool CCCIsCC()
const {
return Mode == GCCMode; }
206 std::string DefaultTargetTriple;
209 std::string CCCGenericGCCName;
213 unsigned CheckInputsExist : 1;
226 unsigned SuppressMissingInputWarning : 1;
228 std::list<std::string> TempFiles;
229 std::list<std::string> ResultFiles;
236 mutable llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains;
241 llvm::opt::DerivedArgList *
242 TranslateInputArgs(
const llvm::opt::InputArgList &Args)
const;
246 phases::ID getFinalPhase(
const llvm::opt::DerivedArgList &DAL,
247 llvm::opt::Arg **FinalPhaseArg =
nullptr)
const;
252 void generatePrefixedToolNames(StringRef
Tool,
const ToolChain &TC,
266 bool getCrashDiagnosticFile(StringRef ReproCrashFilename,
280 const llvm::opt::OptTable &
getOpts()
const {
return *Opts; }
345 bool &ContainsError);
393 const Command &FailingCommand);
444 StringRef BoundArch,
bool AtTopLevel,
bool MultipleArchs,
445 const char *LinkingOutput,
446 std::map<std::pair<const Action *, std::string>,
InputInfo>
466 const char *BaseInput, StringRef BoundArch,
467 bool AtTopLevel,
bool MultipleArchs,
468 StringRef NormalizedTriple)
const;
492 void setDriverModeFromOption(StringRef Opt);
496 void setLTOMode(
const llvm::opt::ArgList &Args);
502 const ToolChain &getToolChain(
const llvm::opt::ArgList &Args,
503 const llvm::Triple &Target)
const;
509 std::pair<unsigned, unsigned> getIncludeExcludeOptionFlagMasks()
const;
516 bool AtTopLevel,
bool MultipleArchs,
const char *LinkingOutput,
517 std::map<std::pair<const Action *, std::string>,
InputInfo>
530 unsigned &Micro,
bool &HadExtra);
static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor, unsigned &Micro, bool &HadExtra)
GetReleaseVersion - Parse (([0-9]+)(.
ID
ID - Ordered values for successive stages in the compilation process which interact with user options...
Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple, DiagnosticsEngine &Diags, IntrusiveRefCntPtr< vfs::FileSystem > VFS=nullptr)
std::string GetProgramPath(StringRef Name, const ToolChain &TC) const
GetProgramPath - Lookup Name in the list of program search paths.
InputInfo BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput, std::map< std::pair< const Action *, std::string >, InputInfo > &CachedResults, Action::OffloadKind TargetDeviceOffloadKind) const
BuildJobsForAction - Construct the jobs to perform for the action A and return an InputInfo for the r...
unsigned CCPrintHeaders
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHead...
unsigned CCCUsePCH
Use lazy precompiled headers for PCH support.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
const llvm::opt::OptTable & getOpts() const
std::string DyldPrefix
Dynamic loader prefix, if present.
DiagnosticBuilder Diag(unsigned DiagID) const
Compilation * BuildCompilation(ArrayRef< const char * > Args)
BuildCompilation - Construct a compilation object for a command line argument vector.
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.
bool ShouldUseClangCompiler(const JobAction &JA) const
ShouldUseClangCompiler - Should the clang compiler be used to handle this action. ...
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
bool embedBitcodeInObject() const
The virtual file system interface.
std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const
GetTemporaryPath - Return the pathname of a temporary file to use as part of compilation; the file wi...
llvm::opt::InputArgList ParseArgStrings(ArrayRef< const char * > Args, bool &ContainsError)
ParseArgStrings - Parse the given list of strings into an ArgList.
void PrintHelp(bool ShowHidden) const
PrintHelp - Print the help text.
unsigned CCLogDiagnostics
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename...
const std::string & getTitle()
void PrintActions(const Compilation &C) const
PrintActions - Print the list of actions.
std::string Dir
The path the driver executable was in, as invoked from the command line.
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const
Compute the desired OpenMP runtime from the flags provided.
Action - Represent an abstract compilation step to perform.
bool HandleImmediateArgs(const Compilation &C)
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding...
const char * getInstalledDir() const
Get the path to where the clang executable was installed.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Concrete class used by the front-end to report problems and issues.
bool embedBitcodeEnabled() const
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 ...
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
bool IsCLMode() const
Whether the driver should follow cl.exe like behavior.
Defines the Diagnostic-related interfaces.
void generateCompilationDiagnostics(Compilation &C, const Command &FailingCommand)
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(...
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
An unknown OpenMP runtime.
const char * CCPrintOptionsFilename
The file to log CC_PRINT_OPTIONS output to, if enabled.
void PrintVersion(const Compilation &C, raw_ostream &OS) const
PrintVersion - Print the driver version.
bool isSaveTempsEnabled() const
SmallVector< std::pair< types::ID, const llvm::opt::Arg * >, 16 > InputList
A list of inputs and their types for the given arguments.
A little helper class used to produce diagnostics.
void ParseDriverMode(StringRef ProgramName, ArrayRef< const char * > Args)
ParseDriverMode - Look for and handle the driver mode option in Args.
bool CCCIsCC() const
Whether the driver should follow gcc like behavior.
bool getCheckInputsExist() const
unsigned GenReproducer
Force clang to emit reproducer for driver invocation.
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...
unsigned CCPrintOptions
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to std...
vfs::FileSystem & getVFS() const
void setCheckInputsExist(bool Value)
int ExecuteCompilation(Compilation &C, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands)
ExecuteCompilation - Execute the compilation according to the command line arguments and return an ap...
std::string GetClPchPath(Compilation &C, StringRef BaseName) const
Return the pathname of the pch file in clang-cl mode.
bool embedBitcodeMarkerOnly() const
bool UseStdLib
If the standard library is used.
void BuildJobs(Compilation &C) const
BuildJobs - Bind actions to concrete tools and translate arguments to form the list of jobs to run...
std::string HostBits
Information about the host which can be overridden by the user.
Command - An executable path/name and argument vector to execute.
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
std::string InstalledDir
The path to the installed clang directory, if any.
bool isSaveTempsObj() const
LTOKind getLTOMode() const
Get the specific kind of LTO being performed.
void setTitle(std::string Value)
const char * getDefaultImageName() const
Returns the default name for linked images (e.g., "a.out").
bool CCCIsCPP() const
Whether the driver is just the preprocessor.
const char * CCPrintHeadersFilename
The file to log CC_PRINT_HEADERS output to, if enabled.
unsigned CCCPrintBindings
Only print tool bindings, don't build any jobs.
std::string SysRoot
sysroot, if present
std::string Name
The name the driver was invoked as.
const char * getClangProgramPath() const
Get the path to the main clang executable.
std::string ClangExecutable
The original path to the clang executable.
std::string GetFilePath(StringRef Name, const ToolChain &TC) const
GetFilePath - Lookup Name in the list of file search paths.
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.
Compilation - A set of tasks to perform for a single driver invocation.
const DiagnosticsEngine & getDiags() const
SmallVector< std::string, 4 > prefix_list
A prefix directory used to emulate a limited subset of GCC's '-Bprefix' functionality.
const char * CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
bool isUsingLTO() const
Returns true if we are performing any kind of LTO.
const char * GetNamedOutputPath(Compilation &C, const JobAction &JA, const char *BaseInput, StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, StringRef NormalizedTriple) const
GetNamedOutputPath - Return the name to use for the output of the action JA.
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
const std::string & getCCCGenericGCCName() const
Name to use when invoking gcc/g++.
std::string DriverTitle
Driver title to use with help.
void setInstalledDir(StringRef Value)
void CreateOffloadingDeviceToolChains(Compilation &C, InputList &Inputs)
CreateOffloadingDeviceToolChains - create all the toolchains required to support offloading devices g...
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
std::string ResourceDir
The path to the compiler resource directory.