class Driver

Declaration

class Driver { /* full declaration omitted */ };

Description

Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like command line arguments.

Declared at: clang/include/clang/Driver/Driver.h:70

Member Variables

private clang::DiagnosticsEngine& Diags
private IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS
private enum DriverMode Mode
private enum SaveTempsMode SaveTemps
private enum BitcodeEmbedMode BitcodeEmbed
private enum OffloadMode Offload
private clang::driver::ModuleHeaderMode CXX20HeaderType
Header unit mode set by -fmodule-header={user,system}.
private bool ModulesModeCXX20
Set if we should process inputs and jobs with C++20 module interpretation.
private clang::driver::LTOKind LTOMode
LTO mode selected via -f(no-)?lto(=.*)? options.
private clang::driver::LTOKind OffloadLTOMode
LTO mode selected via -f(no-offload-)?lto(=.*)? options.
public std::string Name
The name the driver was invoked as.
public std::string Dir
The path the driver executable was in, as invoked from the command line.
public std::string ClangExecutable
The original path to the clang executable.
public clang::driver::ParsedClangName ClangNameParts
Target and driver mode components extracted from clang executable name.
public std::string InstalledDir
The path to the installed clang directory, if any.
public std::string ResourceDir
The path to the compiler resource directory.
public std::string SystemConfigDir
System directory for config files.
public std::string UserConfigDir
User directory for config files.
public clang::driver::Driver::prefix_list PrefixDirs
public std::string SysRoot
sysroot, if present
public std::string DyldPrefix
Dynamic loader prefix, if present
public std::string DriverTitle
Driver title to use with help.
public std::string HostBits
Information about the host which can be overridden by the user.
public std::string HostMachine
Information about the host which can be overridden by the user.
public std::string HostSystem
Information about the host which can be overridden by the user.
public std::string HostRelease
Information about the host which can be overridden by the user.
public std::string CCPrintStatReportFilename
The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
public std::string CCPrintOptionsFilename
The file to log CC_PRINT_OPTIONS output to, if enabled.
public std::string CCPrintHeadersFilename
The file to log CC_PRINT_HEADERS output to, if enabled.
public std::string CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
public unsigned int CCCPrintBindings
Only print tool bindings, don't build any jobs.
public unsigned int CCPrintOptions
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to stderr.
public unsigned int CCPrintHeaders
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHeadersFilename or to stderr.
public unsigned int CCLogDiagnostics
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename or to stderr, in a stable machine readable format.
public unsigned int CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
public unsigned int CCPrintProcessStats
Set CC_PRINT_PROC_STAT mode, which causes the driver to dump performance report to CC_PRINT_PROC_STAT_FILE or to stdout.
public clang::driver::Driver::CC1ToolFunc CC1Main = nullptr
private std::string TargetTriple
Raw target triple.
private std::string CCCGenericGCCName
Name to use when invoking gcc/g++.
private std::string ConfigFile
Name of configuration file if used.
private llvm::BumpPtrAllocator Alloc
Allocator for string saver.
private llvm::StringSaver Saver
Object that stores strings read from configuration file.
private std::unique_ptr<llvm::opt::InputArgList> CfgOptions
Arguments originated from configuration file.
private std::unique_ptr<llvm::opt::InputArgList> CLOptions
Arguments originated from command line.
private unsigned int CheckInputsExist
Whether to check that input files exist when constructing compilation jobs.
private unsigned int ProbePrecompiled
Whether to probe for PCH files on disk, in order to upgrade -include foo.h to -include-pch foo.h.pch.
private unsigned int SuppressMissingInputWarning
Certain options suppress the 'no input files' warning.
private llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains
This maps from the string representation of a triple to a ToolChain created targeting that triple. The driver owns all the ToolChain objects stored in it, and will clean them up when torn down.
private llvm::DenseMap<const ToolChain*, llvm::DenseSet<llvm::StringRef>> KnownArchs
Cache of known offloading architectures for the ToolChain already derived. This should only be modified when we first initialize the offloading toolchains.

Method Overview

  • public void BuildActions(clang::driver::Compilation & C, llvm::opt::DerivedArgList & Args, const clang::driver::Driver::InputList & Inputs, clang::driver::ActionList & Actions) const
  • public clang::driver::Compilation * BuildCompilation(ArrayRef<const char *> Args)
  • public void BuildInputs(const clang::driver::ToolChain & TC, llvm::opt::DerivedArgList & Args, clang::driver::Driver::InputList & Inputs) const
  • public void BuildJobs(clang::driver::Compilation & C) const
  • public clang::driver::InputInfoList BuildJobsForAction(clang::driver::Compilation & C, const clang::driver::Action * A, const clang::driver::ToolChain * TC, llvm::StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, const char * LinkingOutput, std::map<std::pair<const Action *, std::string>, InputInfoList> & CachedResults, Action::OffloadKind TargetDeviceOffloadKind) const
  • private clang::driver::InputInfoList BuildJobsForActionNoCache(clang::driver::Compilation & C, const clang::driver::Action * A, const clang::driver::ToolChain * TC, llvm::StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, const char * LinkingOutput, std::map<std::pair<const Action *, std::string>, InputInfoList> & CachedResults, Action::OffloadKind TargetDeviceOffloadKind) const
  • public clang::driver::Action * BuildOffloadingActions(clang::driver::Compilation & C, llvm::opt::DerivedArgList & Args, const clang::driver::Driver::InputTy & Input, clang::driver::Action * HostAction) const
  • public void BuildUniversalActions(clang::driver::Compilation & C, const clang::driver::ToolChain & TC, const clang::driver::Driver::InputList & BAInputs) const
  • public bool CCCIsCC() const
  • public bool CCCIsCPP() const
  • public bool CCCIsCXX() const
  • public clang::driver::Action * ConstructPhaseAction(clang::driver::Compilation & C, const llvm::opt::ArgList & Args, phases::ID Phase, clang::driver::Action * Input, Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None) const
  • public void CreateOffloadingDeviceToolChains(clang::driver::Compilation & C, clang::driver::Driver::InputList & Inputs)
  • public clang::DiagnosticBuilder Diag(unsigned int DiagID) const
  • public bool DiagnoseInputExistence(const llvm::opt::DerivedArgList & Args, llvm::StringRef Value, types::ID Ty, bool TypoCorrect) const
  • public Driver(llvm::StringRef ClangExecutable, llvm::StringRef TargetTriple, clang::DiagnosticsEngine & Diags, std::string Title = "clang LLVM compiler", IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr)
  • public int ExecuteCompilation(clang::driver::Compilation & C, SmallVectorImpl<std::pair<int, const Command *>> & FailingCommands)
  • public std::string GetClPchPath(clang::driver::Compilation & C, llvm::StringRef BaseName) const
  • public std::string GetFilePath(llvm::StringRef Name, const clang::driver::ToolChain & TC) const
  • public const char * GetNamedOutputPath(clang::driver::Compilation & C, const clang::driver::JobAction & JA, const char * BaseInput, llvm::StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, llvm::StringRef NormalizedTriple) const
  • public std::string GetProgramPath(llvm::StringRef Name, const clang::driver::ToolChain & TC) const
  • public static bool GetReleaseVersion(llvm::StringRef Str, MutableArrayRef<unsigned int> Digits)
  • public static bool GetReleaseVersion(llvm::StringRef Str, unsigned int & Major, unsigned int & Minor, unsigned int & Micro, bool & HadExtra)
  • public static std::string GetResourcesPath(llvm::StringRef BinaryPath, llvm::StringRef CustomResourceDir = "")
  • public std::string GetTemporaryDirectory(llvm::StringRef Prefix) const
  • public std::string GetTemporaryPath(llvm::StringRef Prefix, llvm::StringRef Suffix) const
  • public void HandleAutocompletions(llvm::StringRef PassedFlags) const
  • public bool HandleImmediateArgs(const clang::driver::Compilation & C)
  • public bool IsCLMode() const
  • public bool IsDXCMode() const
  • public bool IsFlangMode() const
  • public llvm::opt::InputArgList ParseArgStrings(ArrayRef<const char *> Args, bool IsClCompatMode, bool & ContainsError)
  • public void PrintActions(const clang::driver::Compilation & C) const
  • public void PrintHelp(bool ShowHidden) const
  • public void PrintVersion(const clang::driver::Compilation & C, llvm::raw_ostream & OS) const
  • public bool ShouldEmitStaticLibrary(const llvm::opt::ArgList & Args) const
  • public bool ShouldUseClangCompiler(const clang::driver::JobAction & JA) const
  • public bool ShouldUseFlangCompiler(const clang::driver::JobAction & JA) const
  • private llvm::opt::DerivedArgList * TranslateInputArgs(const llvm::opt::InputArgList & Args) const
  • public bool embedBitcodeEnabled() const
  • public bool embedBitcodeInObject() const
  • public bool embedBitcodeMarkerOnly() const
  • public void generateCompilationDiagnostics(clang::driver::Compilation & C, const clang::driver::Command & FailingCommand, llvm::StringRef AdditionalInformation = "", clang::driver::Driver::CompilationDiagnosticReport * GeneratedReport = nullptr)
  • private void generatePrefixedToolNames(llvm::StringRef Tool, const clang::driver::ToolChain & TC, SmallVectorImpl<std::string> & Names) const
  • public const std::string & getCCCGenericGCCName() const
  • public bool getCheckInputsExist() const
  • public const char * getClangProgramPath() const
  • public const std::string & getConfigFile() const
  • private bool getCrashDiagnosticFile(llvm::StringRef ReproCrashFilename, SmallString<128> & CrashDiagDir)
  • public const char * getDefaultImageName() const
  • public static bool getDefaultModuleCachePath(SmallVectorImpl<char> & Result)
  • public clang::DiagnosticsEngine & getDiags() const
  • public phases::ID getFinalPhase(const llvm::opt::DerivedArgList & DAL, llvm::opt::Arg ** FinalPhaseArg = nullptr) const
  • private std::pair<unsigned int, unsigned int> getIncludeExcludeOptionFlagMasks(bool IsClCompatMode) const
  • public const char * getInstalledDir() const
  • public clang::driver::LTOKind getLTOMode(bool IsOffload = false) const
  • public clang::driver::ModuleHeaderMode getModuleHeaderMode() const
  • public llvm::DenseSet<StringRef> getOffloadArchs(clang::driver::Compilation & C, const llvm::opt::DerivedArgList & Args, Action::OffloadKind Kind, const clang::driver::ToolChain * TC) const
  • private const clang::driver::ToolChain & getOffloadingDeviceToolChain(const llvm::opt::ArgList & Args, const llvm::Triple & Target, const clang::driver::ToolChain & HostTC, const Action::OffloadKind & TargetDeviceOffloadKind) const
  • public clang::driver::Driver::OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList & Args) const
  • public const llvm::opt::OptTable & getOpts() const
  • public bool getProbePrecompiled() const
  • public std::string getTargetTriple() const
  • public const std::string & getTitle()
  • private const clang::driver::ToolChain & getToolChain(const llvm::opt::ArgList & Args, const llvm::Triple & Target) const
  • public llvm::vfs::FileSystem & getVFS() const
  • private void handleArguments(clang::driver::Compilation & C, llvm::opt::DerivedArgList & Args, const clang::driver::Driver::InputList & Inputs, clang::driver::ActionList & Actions) const
  • public bool hasHeaderMode() const
  • public bool isSaveTempsEnabled() const
  • public bool isSaveTempsObj() const
  • public bool isUsingLTO(bool IsOffload = false) const
  • private bool loadConfigFile()
  • public bool maybeGenerateCompilationDiagnostics(clang::driver::Driver::CommandStatus CS, clang::driver::Driver::ReproLevel Level, clang::driver::Compilation & C, const clang::driver::Command & FailingCommand, llvm::StringRef AdditionalInformation = "", clang::driver::Driver::CompilationDiagnosticReport * GeneratedReport = nullptr)
  • public bool offloadDeviceOnly() const
  • public bool offloadHostOnly() const
  • private bool readConfigFile(llvm::StringRef FileName)
  • public void setCheckInputsExist(bool Value)
  • private void setDriverMode(llvm::StringRef DriverModeValue)
  • public void setInstalledDir(llvm::StringRef Value)
  • private void setLTOMode(const llvm::opt::ArgList & Args)
  • public void setProbePrecompiled(bool Value)
  • public void setTargetAndMode(const clang::driver::ParsedClangName & TM)
  • public void setTitle(std::string Value)
  • private void setUpResponseFiles(clang::driver::Compilation & C, clang::driver::Command & Cmd)

Methods

void BuildActions(
    clang::driver::Compilation& C,
    llvm::opt::DerivedArgList& Args,
    const clang::driver::Driver::InputList&
        Inputs,
    clang::driver::ActionList& Actions) const

Description

BuildActions - Construct the list of actions to perform for the given arguments, which are only done for a single architecture.

Declared at: clang/include/clang/Driver/Driver.h:444

Parameters

clang::driver::Compilation& C
- The compilation that is being built.
llvm::opt::DerivedArgList& Args
- The input arguments.
const clang::driver::Driver::InputList& Inputs
clang::driver::ActionList& Actions
- The list to store the resulting actions onto.

clang::driver::Compilation* BuildCompilation(
    ArrayRef<const char*> Args)

Description

BuildCompilation - Construct a compilation object for a command line argument vector.

Declared at: clang/include/clang/Driver/Driver.h:420

Parameters

ArrayRef<const char*> Args

Returns

A compilation, or 0 if none was built for the given argument vector. A null return value does not necessarily indicate an error condition, the diagnostics should be queried to determine if an error occurred.

void BuildInputs(
    const clang::driver::ToolChain& TC,
    llvm::opt::DerivedArgList& Args,
    clang::driver::Driver::InputList& Inputs)
    const

Description

BuildInputs - Construct the list of inputs and their types from the given arguments.

Declared at: clang/include/clang/Driver/Driver.h:435

Parameters

const clang::driver::ToolChain& TC
- The default host tool chain.
llvm::opt::DerivedArgList& Args
- The input arguments.
clang::driver::Driver::InputList& Inputs
- The list to store the resulting compilation inputs onto.

void BuildJobs(
    clang::driver::Compilation& C) const

Description

BuildJobs - Bind actions to concrete tools and translate arguments to form the list of jobs to run.

Declared at: clang/include/clang/Driver/Driver.h:486

Parameters

clang::driver::Compilation& C
- The compilation that is being built.

clang::driver::InputInfoList BuildJobsForAction(
    clang::driver::Compilation& C,
    const clang::driver::Action* A,
    const clang::driver::ToolChain* TC,
    llvm::StringRef BoundArch,
    bool AtTopLevel,
    bool MultipleArchs,
    const char* LinkingOutput,
    std::map<
        std::pair<const Action*, std::string>,
        InputInfoList>& CachedResults,
    Action::OffloadKind TargetDeviceOffloadKind)
    const

Description

BuildJobsForAction - Construct the jobs to perform for the action \p A and return an InputInfo for the result of running \p A. Will only construct jobs for a given (Action, ToolChain, BoundArch, DeviceKind) tuple once.

Declared at: clang/include/clang/Driver/Driver.h:593

Parameters

clang::driver::Compilation& C
const clang::driver::Action* A
const clang::driver::ToolChain* TC
llvm::StringRef BoundArch
bool AtTopLevel
bool MultipleArchs
const char* LinkingOutput
std::map<std::pair<const Action*, std::string>, InputInfoList>& CachedResults
Action::OffloadKind TargetDeviceOffloadKind

clang::driver::InputInfoList
BuildJobsForActionNoCache(
    clang::driver::Compilation& C,
    const clang::driver::Action* A,
    const clang::driver::ToolChain* TC,
    llvm::StringRef BoundArch,
    bool AtTopLevel,
    bool MultipleArchs,
    const char* LinkingOutput,
    std::map<
        std::pair<const Action*, std::string>,
        InputInfoList>& CachedResults,
    Action::OffloadKind TargetDeviceOffloadKind)
    const

Description

Helper used in BuildJobsForAction. Doesn't use the cache when building jobs specifically for the given action, but will use the cache when building jobs for the Action's inputs.

Declared at: clang/include/clang/Driver/Driver.h:712

Parameters

clang::driver::Compilation& C
const clang::driver::Action* A
const clang::driver::ToolChain* TC
llvm::StringRef BoundArch
bool AtTopLevel
bool MultipleArchs
const char* LinkingOutput
std::map<std::pair<const Action*, std::string>, InputInfoList>& CachedResults
Action::OffloadKind TargetDeviceOffloadKind

clang::driver::Action* BuildOffloadingActions(
    clang::driver::Compilation& C,
    llvm::opt::DerivedArgList& Args,
    const clang::driver::Driver::InputTy& Input,
    clang::driver::Action* HostAction) const

Description

BuildOffloadingActions - Construct the list of actions to perform for the offloading toolchain that will be embedded in the host.

Declared at: clang/include/clang/Driver/Driver.h:462

Parameters

clang::driver::Compilation& C
- The compilation that is being built.
llvm::opt::DerivedArgList& Args
- The input arguments.
const clang::driver::Driver::InputTy& Input
- The input type and arguments
clang::driver::Action* HostAction
- The host action used in the offloading toolchain.

void BuildUniversalActions(
    clang::driver::Compilation& C,
    const clang::driver::ToolChain& TC,
    const clang::driver::Driver::InputList&
        BAInputs) const

Description

BuildUniversalActions - Construct the list of actions to perform for the given arguments, which may require a universal build.

Declared at: clang/include/clang/Driver/Driver.h:452

Parameters

clang::driver::Compilation& C
- The compilation that is being built.
const clang::driver::ToolChain& TC
- The default host tool chain.
const clang::driver::Driver::InputList& BAInputs

bool CCCIsCC() const

Description

Whether the driver should follow gcc like behavior.

Declared at: clang/include/clang/Driver/Driver.h:212

bool CCCIsCPP() const

Description

Whether the driver is just the preprocessor.

Declared at: clang/include/clang/Driver/Driver.h:209

bool CCCIsCXX() const

Description

Whether the driver should follow g++ like behavior.

Declared at: clang/include/clang/Driver/Driver.h:206

clang::driver::Action* ConstructPhaseAction(
    clang::driver::Compilation& C,
    const llvm::opt::ArgList& Args,
    phases::ID Phase,
    clang::driver::Action* Input,
    Action::OffloadKind TargetDeviceOffloadKind =
        Action::OFK_None) const

Description

ConstructAction - Construct the appropriate action to do for\p Phase on the \p Input, taking in to account arguments like -fsyntax-only or --analyze.

Declared at: clang/include/clang/Driver/Driver.h:585

Parameters

clang::driver::Compilation& C
const llvm::opt::ArgList& Args
phases::ID Phase
clang::driver::Action* Input
Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None

void CreateOffloadingDeviceToolChains(
    clang::driver::Compilation& C,
    clang::driver::Driver::InputList& Inputs)

Description

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.

Declared at: clang/include/clang/Driver/Driver.h:411

Parameters

clang::driver::Compilation& C
clang::driver::Driver::InputList& Inputs

clang::DiagnosticBuilder Diag(
    unsigned int DiagID) const

Declared at: clang/include/clang/Driver/Driver.h:137

Parameters

unsigned int DiagID

bool DiagnoseInputExistence(
    const llvm::opt::DerivedArgList& Args,
    llvm::StringRef Value,
    types::ID Ty,
    bool TypoCorrect) const

Description

Check that the file referenced by Value exists. If it doesn't, issue a diagnostic and return false. If TypoCorrect is true and the file does not exist, see if it looks like a likely typo for a flag and if so print a "did you mean" blurb.

Declared at: clang/include/clang/Driver/Driver.h:478

Parameters

const llvm::opt::DerivedArgList& Args
llvm::StringRef Value
types::ID Ty
bool TypoCorrect

Driver(llvm::StringRef ClangExecutable,
       llvm::StringRef TargetTriple,
       clang::DiagnosticsEngine& Diags,
       std::string Title = "clang LLVM compiler",
       IntrusiveRefCntPtr<llvm::vfs::FileSystem>
           VFS = nullptr)

Declared at: clang/include/clang/Driver/Driver.h:346

Parameters

llvm::StringRef ClangExecutable
llvm::StringRef TargetTriple
clang::DiagnosticsEngine& Diags
std::string Title = "clang LLVM compiler"
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr

int ExecuteCompilation(
    clang::driver::Compilation& C,
    SmallVectorImpl<
        std::pair<int, const Command*>>&
        FailingCommands)

Description

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.

Declared at: clang/include/clang/Driver/Driver.h:494

Parameters

clang::driver::Compilation& C
SmallVectorImpl<std::pair<int, const Command*>>& FailingCommands

std::string GetClPchPath(
    clang::driver::Compilation& C,
    llvm::StringRef BaseName) const

Description

Return the pathname of the pch file in clang-cl mode.

Declared at: clang/include/clang/Driver/Driver.h:631

Parameters

clang::driver::Compilation& C
llvm::StringRef BaseName

std::string GetFilePath(
    llvm::StringRef Name,
    const clang::driver::ToolChain& TC) const

Description

GetFilePath - Lookup \p Name in the list of file search paths.

Declared at: clang/include/clang/Driver/Driver.h:561

Parameters

llvm::StringRef Name
const clang::driver::ToolChain& TC
- The tool chain for additional information on directories to search.

const char* GetNamedOutputPath(
    clang::driver::Compilation& C,
    const clang::driver::JobAction& JA,
    const char* BaseInput,
    llvm::StringRef BoundArch,
    bool AtTopLevel,
    bool MultipleArchs,
    llvm::StringRef NormalizedTriple) const

Description

GetNamedOutputPath - Return the name to use for the output of the action \p JA. The result is appended to the compilation's list of temporary or result files, as appropriate.

Declared at: clang/include/clang/Driver/Driver.h:615

Parameters

clang::driver::Compilation& C
- The compilation.
const clang::driver::JobAction& JA
- The action of interest.
const char* BaseInput
- The original input file that this action was triggered by.
llvm::StringRef BoundArch
- The bound architecture.
bool AtTopLevel
- Whether this is a "top-level" action.
bool MultipleArchs
- Whether multiple -arch options were supplied.
llvm::StringRef NormalizedTriple
- The normalized triple of the relevant target.

std::string GetProgramPath(
    llvm::StringRef Name,
    const clang::driver::ToolChain& TC) const

Description

GetProgramPath - Lookup \p Name in the list of program search paths.

Declared at: clang/include/clang/Driver/Driver.h:569

Parameters

llvm::StringRef Name
const clang::driver::ToolChain& TC
- The provided tool chain for additional information on directories to search.

static bool GetReleaseVersion(
    llvm::StringRef Str,
    MutableArrayRef<unsigned int> Digits)

Description

Parse digits from a string \p Str and fulfill \p Digits with the parsed numbers. This method assumes that the max number of digits to look for is equal to Digits.size().

Declared at: clang/include/clang/Driver/Driver.h:736

Parameters

llvm::StringRef Str
MutableArrayRef<unsigned int> Digits

Returns

True if the entire string was parsed and there are no extra characters remaining at the end.

static bool GetReleaseVersion(llvm::StringRef Str,
                              unsigned int& Major,
                              unsigned int& Minor,
                              unsigned int& Micro,
                              bool& HadExtra)

Description

GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and return the grouped values as integers. Numbers which are not provided are set to 0.

Declared at: clang/include/clang/Driver/Driver.h:727

Parameters

llvm::StringRef Str
unsigned int& Major
unsigned int& Minor
unsigned int& Micro
bool& HadExtra

Returns

True if the entire string was parsed (9.2), or all groups were parsed (10.3.5extrastuff). HadExtra is true if all groups were parsed but extra characters remain at the end.

static std::string GetResourcesPath(
    llvm::StringRef BinaryPath,
    llvm::StringRef CustomResourceDir = "")

Description

Takes the path to a binary that's either in bin/ or lib/ and returns the path to clang's resource directory.

Declared at: clang/include/clang/Driver/Driver.h:343

Parameters

llvm::StringRef BinaryPath
llvm::StringRef CustomResourceDir = ""

std::string GetTemporaryDirectory(
    llvm::StringRef Prefix) const

Description

GetTemporaryDirectory - Return the pathname of a temporary directory to use as part of compilation; the directory will have the given prefix.

Declared at: clang/include/clang/Driver/Driver.h:628

Parameters

llvm::StringRef Prefix

std::string GetTemporaryPath(
    llvm::StringRef Prefix,
    llvm::StringRef Suffix) const

Description

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.

Declared at: clang/include/clang/Driver/Driver.h:624

Parameters

llvm::StringRef Prefix
llvm::StringRef Suffix

void HandleAutocompletions(
    llvm::StringRef PassedFlags) const

Description

HandleAutocompletions - Handle --autocomplete by searching and printing possible flags, descriptions, and its arguments.

Declared at: clang/include/clang/Driver/Driver.h:573

Parameters

llvm::StringRef PassedFlags

bool HandleImmediateArgs(
    const clang::driver::Compilation& C)

Description

HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding tools.

Declared at: clang/include/clang/Driver/Driver.h:580

Parameters

const clang::driver::Compilation& C

Returns

Whether any compilation should be built for this invocation.

bool IsCLMode() const

Description

Whether the driver should follow cl.exe like behavior.

Declared at: clang/include/clang/Driver/Driver.h:215

bool IsDXCMode() const

Description

Whether the driver should follow dxc.exe like behavior.

Declared at: clang/include/clang/Driver/Driver.h:222

bool IsFlangMode() const

Description

Whether the driver should invoke flang for fortran inputs. Other modes fall back to calling gcc which in turn calls gfortran.

Declared at: clang/include/clang/Driver/Driver.h:219

llvm::opt::InputArgList ParseArgStrings(
    ArrayRef<const char*> Args,
    bool IsClCompatMode,
    bool& ContainsError)

Description

ParseArgStrings - Parse the given list of strings into an ArgList.

Declared at: clang/include/clang/Driver/Driver.h:424

Parameters

ArrayRef<const char*> Args
bool IsClCompatMode
bool& ContainsError

void PrintActions(
    const clang::driver::Compilation& C) const

Description

PrintActions - Print the list of actions.

Declared at: clang/include/clang/Driver/Driver.h:545

Parameters

const clang::driver::Compilation& C

void PrintHelp(bool ShowHidden) const

Description

PrintHelp - Print the help text.

Declared at: clang/include/clang/Driver/Driver.h:550

Parameters

bool ShowHidden
- Show hidden options.

void PrintVersion(
    const clang::driver::Compilation& C,
    llvm::raw_ostream& OS) const

Description

PrintVersion - Print the driver version.

Declared at: clang/include/clang/Driver/Driver.h:553

Parameters

const clang::driver::Compilation& C
llvm::raw_ostream& OS

bool ShouldEmitStaticLibrary(
    const llvm::opt::ArgList& Args) const

Description

ShouldEmitStaticLibrary - Should the linker emit a static library.

Declared at: clang/include/clang/Driver/Driver.h:642

Parameters

const llvm::opt::ArgList& Args

bool ShouldUseClangCompiler(
    const clang::driver::JobAction& JA) const

Description

ShouldUseClangCompiler - Should the clang compiler be used to handle this action.

Declared at: clang/include/clang/Driver/Driver.h:635

Parameters

const clang::driver::JobAction& JA

bool ShouldUseFlangCompiler(
    const clang::driver::JobAction& JA) const

Description

ShouldUseFlangCompiler - Should the flang compiler be used to handle this action.

Declared at: clang/include/clang/Driver/Driver.h:639

Parameters

const clang::driver::JobAction& JA

llvm::opt::DerivedArgList* TranslateInputArgs(
    const llvm::opt::InputArgList& Args) const

Description

TranslateInputArgs - Create a new derived argument list from the input arguments, after applying the standard argument translations.

Declared at: clang/include/clang/Driver/Driver.h:312

Parameters

const llvm::opt::InputArgList& Args

bool embedBitcodeEnabled() const

Declared at: clang/include/clang/Driver/Driver.h:394

bool embedBitcodeInObject() const

Declared at: clang/include/clang/Driver/Driver.h:395

bool embedBitcodeMarkerOnly() const

Declared at: clang/include/clang/Driver/Driver.h:396

void generateCompilationDiagnostics(
    clang::driver::Compilation& C,
    const clang::driver::Command& FailingCommand,
    llvm::StringRef AdditionalInformation = "",
    clang::driver::Driver::
        CompilationDiagnosticReport*
            GeneratedReport = nullptr)

Description

generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(s).

Declared at: clang/include/clang/Driver/Driver.h:506

Parameters

clang::driver::Compilation& C
const clang::driver::Command& FailingCommand
llvm::StringRef AdditionalInformation = ""
clang::driver::Driver:: CompilationDiagnosticReport* GeneratedReport = nullptr

void generatePrefixedToolNames(
    llvm::StringRef Tool,
    const clang::driver::ToolChain& TC,
    SmallVectorImpl<std::string>& Names) const

Declared at: clang/include/clang/Driver/Driver.h:322

Parameters

llvm::StringRef Tool
const clang::driver::ToolChain& TC
SmallVectorImpl<std::string>& Names

const std::string& getCCCGenericGCCName() const

Description

Name to use when invoking gcc/g++.

Declared at: clang/include/clang/Driver/Driver.h:354

bool getCheckInputsExist() const

Declared at: clang/include/clang/Driver/Driver.h:364

const char* getClangProgramPath() const

Description

Get the path to the main clang executable.

Declared at: clang/include/clang/Driver/Driver.h:379

const std::string& getConfigFile() const

Declared at: clang/include/clang/Driver/Driver.h:356

bool getCrashDiagnosticFile(
    llvm::StringRef ReproCrashFilename,
    SmallString<128>& CrashDiagDir)

Description

Find the appropriate .crash diagonostic file for the child crash under this driver and copy it out to a temporary destination with the other reproducer related files (.sh, .cache, etc). If not found, suggest a directory for the user to look at.

Declared at: clang/include/clang/Driver/Driver.h:336

Parameters

llvm::StringRef ReproCrashFilename
The file path to copy the .crash to.
SmallString<128>& CrashDiagDir
The suggested directory for the user to look at in case the search or copy fails.

Returns

If the .crash is found and successfully copied return true, otherwise false and return the suggested directory in \p CrashDiagDir.

const char* getDefaultImageName() const

Description

Returns the default name for linked images (e.g., "a.out").

Declared at: clang/include/clang/Driver/Driver.h:601

static bool getDefaultModuleCachePath(
    SmallVectorImpl<char>& Result)

Description

Compute the default -fmodule-cache-path.

Declared at: clang/include/clang/Driver/Driver.h:740

Parameters

SmallVectorImpl<char>& Result

Returns

True if the system provides a default cache directory.

clang::DiagnosticsEngine& getDiags() const

Declared at: clang/include/clang/Driver/Driver.h:360

phases::ID getFinalPhase(
    const llvm::opt::DerivedArgList& DAL,
    llvm::opt::Arg** FinalPhaseArg =
        nullptr) const

Declared at: clang/include/clang/Driver/Driver.h:289

Parameters

const llvm::opt::DerivedArgList& DAL
llvm::opt::Arg** FinalPhaseArg = nullptr

std::pair<unsigned int, unsigned int>
getIncludeExcludeOptionFlagMasks(
    bool IsClCompatMode) const

Description

Get bitmasks for which option flags to include and exclude based on the driver mode.

Declared at: clang/include/clang/Driver/Driver.h:707

Parameters

bool IsClCompatMode

const char* getInstalledDir() const

Description

Get the path to where the clang executable was installed.

Declared at: clang/include/clang/Driver/Driver.h:384

clang::driver::LTOKind getLTOMode(
    bool IsOffload = false) const

Description

Get the specific kind of LTO being performed.

Declared at: clang/include/clang/Driver/Driver.h:656

Parameters

bool IsOffload = false

clang::driver::ModuleHeaderMode
getModuleHeaderMode() const

Description

Get the mode for handling headers as set by fmodule-header{=}.

Declared at: clang/include/clang/Driver/Driver.h:648

llvm::DenseSet<StringRef> getOffloadArchs(
    clang::driver::Compilation& C,
    const llvm::opt::DerivedArgList& Args,
    Action::OffloadKind Kind,
    const clang::driver::ToolChain* TC) const

Description

Returns the set of bound architectures active for this offload kind. If there are no bound architctures we return a set containing only the empty string.

Declared at: clang/include/clang/Driver/Driver.h:471

Parameters

clang::driver::Compilation& C
const llvm::opt::DerivedArgList& Args
Action::OffloadKind Kind
const clang::driver::ToolChain* TC

const clang::driver::ToolChain&
getOffloadingDeviceToolChain(
    const llvm::opt::ArgList& Args,
    const llvm::Triple& Target,
    const clang::driver::ToolChain& HostTC,
    const Action::OffloadKind&
        TargetDeviceOffloadKind) const

Description

Retrieves a ToolChain for a particular device \p Target triple Will cache ToolChains for the life of the driver object, and create them on-demand.

Declared at: clang/include/clang/Driver/Driver.h:700

Parameters

const llvm::opt::ArgList& Args
const llvm::Triple& Target
const clang::driver::ToolChain& HostTC
is the host ToolChain paired with the device
const Action::OffloadKind& TargetDeviceOffloadKind
(e.g. OFK_Cuda/OFK_OpenMP/OFK_SYCL) is an Offloading action that is optionally passed to a ToolChain (used by CUDA, to specify if it's used in conjunction with OpenMP)

clang::driver::Driver::OpenMPRuntimeKind
getOpenMPRuntime(
    const llvm::opt::ArgList& Args) const

Description

Compute the desired OpenMP runtime from the flags provided.

Declared at: clang/include/clang/Driver/Driver.h:402

Parameters

const llvm::opt::ArgList& Args

const llvm::opt::OptTable& getOpts() const

Declared at: clang/include/clang/Driver/Driver.h:358

bool getProbePrecompiled() const

Declared at: clang/include/clang/Driver/Driver.h:368

std::string getTargetTriple() const

Declared at: clang/include/clang/Driver/Driver.h:376

const std::string& getTitle()

Declared at: clang/include/clang/Driver/Driver.h:373

const clang::driver::ToolChain& getToolChain(
    const llvm::opt::ArgList& Args,
    const llvm::Triple& Target) const

Description

Retrieves a ToolChain for a particular \p Target triple. Will cache ToolChains for the life of the driver object, and create them on-demand.

Declared at: clang/include/clang/Driver/Driver.h:685

Parameters

const llvm::opt::ArgList& Args
const llvm::Triple& Target

llvm::vfs::FileSystem& getVFS() const

Declared at: clang/include/clang/Driver/Driver.h:362

void handleArguments(
    clang::driver::Compilation& C,
    llvm::opt::DerivedArgList& Args,
    const clang::driver::Driver::InputList&
        Inputs,
    clang::driver::ActionList& Actions) const

Declared at: clang/include/clang/Driver/Driver.h:316

Parameters

clang::driver::Compilation& C
llvm::opt::DerivedArgList& Args
const clang::driver::Driver::InputList& Inputs
clang::driver::ActionList& Actions

bool hasHeaderMode() const

Description

Returns true if the user has indicated a C++20 header unit mode.

Declared at: clang/include/clang/Driver/Driver.h:645

bool isSaveTempsEnabled() const

Declared at: clang/include/clang/Driver/Driver.h:391

bool isSaveTempsObj() const

Declared at: clang/include/clang/Driver/Driver.h:392

bool isUsingLTO(bool IsOffload = false) const

Description

Returns true if we are performing any kind of LTO.

Declared at: clang/include/clang/Driver/Driver.h:651

Parameters

bool IsOffload = false

bool loadConfigFile()

Description

Tries to load options from configuration file.

Declared at: clang/include/clang/Driver/Driver.h:665

Returns

true if error occurred.

bool maybeGenerateCompilationDiagnostics(
    clang::driver::Driver::CommandStatus CS,
    clang::driver::Driver::ReproLevel Level,
    clang::driver::Compilation& C,
    const clang::driver::Command& FailingCommand,
    llvm::StringRef AdditionalInformation = "",
    clang::driver::Driver::
        CompilationDiagnosticReport*
            GeneratedReport = nullptr)

Declared at: clang/include/clang/Driver/Driver.h:524

Parameters

clang::driver::Driver::CommandStatus CS
clang::driver::Driver::ReproLevel Level
clang::driver::Compilation& C
const clang::driver::Command& FailingCommand
llvm::StringRef AdditionalInformation = ""
clang::driver::Driver:: CompilationDiagnosticReport* GeneratedReport = nullptr

bool offloadDeviceOnly() const

Declared at: clang/include/clang/Driver/Driver.h:399

bool offloadHostOnly() const

Declared at: clang/include/clang/Driver/Driver.h:398

bool readConfigFile(llvm::StringRef FileName)

Description

Read options from the specified file.

Declared at: clang/include/clang/Driver/Driver.h:671

Parameters

llvm::StringRef FileName
File to read.

Returns

true, if error occurred while reading.

void setCheckInputsExist(bool Value)

Declared at: clang/include/clang/Driver/Driver.h:366

Parameters

bool Value

void setDriverMode(
    llvm::StringRef DriverModeValue)

Description

Set the driver mode (cl, gcc, etc) from the value of the `--driver-mode` option.

Declared at: clang/include/clang/Driver/Driver.h:675

Parameters

llvm::StringRef DriverModeValue

void setInstalledDir(llvm::StringRef Value)

Declared at: clang/include/clang/Driver/Driver.h:389

Parameters

llvm::StringRef Value

void setLTOMode(const llvm::opt::ArgList& Args)

Description

Parse the \p Args list for LTO options and record the type of LTO compilation based on which -f(no-)?lto(=.*)? option occurs last.

Declared at: clang/include/clang/Driver/Driver.h:679

Parameters

const llvm::opt::ArgList& Args

void setProbePrecompiled(bool Value)

Declared at: clang/include/clang/Driver/Driver.h:369

Parameters

bool Value

void setTargetAndMode(
    const clang::driver::ParsedClangName& TM)

Declared at: clang/include/clang/Driver/Driver.h:371

Parameters

const clang::driver::ParsedClangName& TM

void setTitle(std::string Value)

Declared at: clang/include/clang/Driver/Driver.h:374

Parameters

std::string Value

void setUpResponseFiles(
    clang::driver::Compilation& C,
    clang::driver::Command& Cmd)

Declared at: clang/include/clang/Driver/Driver.h:320

Parameters

clang::driver::Compilation& C
clang::driver::Command& Cmd