10 #ifndef LLVM_CLANG_DRIVER_DRIVER_H
11 #define LLVM_CLANG_DRIVER_DRIVER_H
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/Support/Path.h"
53 llvm::opt::OptTable *Opts;
73 return Diags.
Report(DiagID);
162 std::string CCCGenericGCCName;
166 unsigned CheckInputsExist : 1;
174 bool SuppressMissingInputWarning : 1;
176 std::list<std::string> TempFiles;
177 std::list<std::string> ResultFiles;
184 mutable llvm::StringMap<ToolChain *> ToolChains;
189 llvm::opt::DerivedArgList *
190 TranslateInputArgs(
const llvm::opt::InputArgList &Args)
const;
194 phases::ID getFinalPhase(
const llvm::opt::DerivedArgList &DAL,
195 llvm::opt::Arg **FinalPhaseArg =
nullptr)
const;
200 void generatePrefixedToolNames(
const char *
Tool,
const ToolChain &TC,
204 Driver(StringRef _ClangExecutable,
205 StringRef _DefaultTargetTriple,
215 const llvm::opt::OptTable &
getOpts()
const {
return *Opts; }
293 llvm::opt::DerivedArgList &Args,
316 const Command &FailingCommand);
359 std::unique_ptr<Action>
368 const char *BoundArch,
371 const char *LinkingOutput,
390 const char *BaseInput,
391 const char *BoundArch,
393 bool MultipleArchs)
const;
405 bool IsUsingLTO(
const llvm::opt::ArgList &Args)
const;
412 const ToolChain &getToolChain(
const llvm::opt::ArgList &Args,
413 const llvm::Triple &Target)
const;
419 std::pair<unsigned, unsigned> getIncludeExcludeOptionFlagMasks()
const;
430 unsigned &Minor,
unsigned &Micro,
void ParseDriverMode(ArrayRef< const char * > Args)
ParseDriverMode - Look for and handle the driver mode option in Args.
void BuildUniversalActions(const ToolChain &TC, llvm::opt::DerivedArgList &Args, const InputList &BAInputs, ActionList &Actions) const
unsigned CCCUsePCH
Use lazy precompiled headers for PCH support.
std::string GetTemporaryPath(StringRef Prefix, const char *Suffix) const
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
static bool GetReleaseVersion(const char *Str, unsigned &Major, unsigned &Minor, unsigned &Micro, bool &HadExtra)
Compilation * BuildCompilation(ArrayRef< const char * > Args)
bool ShouldUseClangCompiler(const JobAction &JA) const
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
void PrintHelp(bool ShowHidden) const
unsigned CCLogDiagnostics
const std::string & getTitle()
void PrintActions(const Compilation &C) const
PrintActions - Print the list of actions.
void BuildActions(const ToolChain &TC, llvm::opt::DerivedArgList &Args, const InputList &Inputs, ActionList &Actions) const
bool HandleImmediateArgs(const Compilation &C)
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...
Driver(StringRef _ClangExecutable, StringRef _DefaultTargetTriple, DiagnosticsEngine &_Diags)
Concrete class used by the front-end to report problems and issues.
std::unique_ptr< Action > ConstructPhaseAction(const ToolChain &TC, const llvm::opt::ArgList &Args, phases::ID Phase, std::unique_ptr< Action > Input) const
bool IsUsingLTO(const llvm::opt::ArgList &Args) const
std::string GetFilePath(const char *Name, const ToolChain &TC) const
llvm::opt::InputArgList ParseArgStrings(ArrayRef< const char * > Args)
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
bool IsCLMode() const
Whether the driver should follow cl.exe like behavior.
void generateCompilationDiagnostics(Compilation &C, const Command &FailingCommand)
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.
bool getCheckInputsExist() const
void setCheckInputsExist(bool Value)
int ExecuteCompilation(Compilation &C, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands)
bool UseStdLib
If the standard library is used.
std::string GetProgramPath(const char *Name, const ToolChain &TC) const
void BuildJobs(Compilation &C) const
std::string HostBits
Information about the host which can be overridden by the user.
std::string InstalledDir
The path to the installed clang directory, if any.
bool isSaveTempsObj() const
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 * GetNamedOutputPath(Compilation &C, const JobAction &JA, const char *BaseInput, const char *BoundArch, bool AtTopLevel, bool MultipleArchs) const
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.
Defines the Diagnostic-related interfaces.
std::string ClangExecutable
The original path to the clang executable.
void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args, InputList &Inputs) const
const DiagnosticsEngine & getDiags() const
SmallVector< std::string, 4 > prefix_list
const char * CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
std::string DefaultTargetTriple
Default target triple.
const std::string & getCCCGenericGCCName() const
Name to use when invoking gcc/g++.
void BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC, const char *BoundArch, bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput, InputInfo &Result) const
std::string DriverTitle
Driver title to use with help.
void setInstalledDir(StringRef Value)
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
std::string ResourceDir
The path to the compiler resource directory.