clang  14.0.0git
Namespaces | Classes | Functions
clang::driver::tools Namespace Reference

Namespaces

 aarch64
 
 aix
 aix – Directly call system default assembler and linker.
 
 AMDGCN
 
 amdgpu
 
 ananas
 ananas – Directly call GNU Binutils assembler and linker
 
 arm
 
 AVR
 
 baremetal
 
 cloudabi
 cloudabi – Directly call GNU Binutils linker
 
 CrossWindows
 
 darwin
 
 dragonfly
 dragonfly – Directly call GNU Binutils assembler and linker
 
 freebsd
 freebsd – Directly call GNU Binutils assembler and linker
 
 fuchsia
 
 gcc
 gcc - Generic GCC tool implementations.
 
 gnutools
 Directly call GNU Binutils' assembler and linker.
 
 hexagon
 
 ifstool
 
 m68k
 
 MinGW
 MinGW – Directly call GNU Binutils assembler and linker.
 
 minix
 minix – Directly call GNU Binutils assembler and linker
 
 mips
 
 msp430
 
 Myriad
 The Myriad toolchain uses tools that are in two different namespaces.
 
 nacltools
 
 netbsd
 netbsd – Directly call GNU Binutils assembler and linker
 
 NVPTX
 
 openbsd
 openbsd – Directly call GNU Binutils assembler and linker
 
 ppc
 
 PS4cpu
 
 riscv
 
 RISCV
 
 SHAVE
 SHAVE tools – Directly call moviCompile and moviAsm.
 
 solaris
 solaris – Directly call Solaris assembler and linker
 
 sparc
 
 SPIRV
 
 systemz
 
 ve
 
 visualstudio
 Visual studio tools.
 
 wasm
 
 x86
 
 XCore
 

Classes

class  Clang
 Clang compiler tool. More...
 
class  ClangAs
 Clang integrated assembler tool. More...
 
class  Flang
 Flang compiler tool. More...
 
class  OffloadBundler
 Offload bundler tool. More...
 
class  OffloadWrapper
 Offload wrapper tool. More...
 

Functions

void addPathIfExists (const Driver &D, const Twine &Path, ToolChain::path_list &Paths)
 
void AddLinkerInputs (const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
 
void addLinkerCompressDebugSectionsOption (const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
 
void claimNoWarnArgs (const llvm::opt::ArgList &Args)
 
bool addSanitizerRuntimes (const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
 
void linkSanitizerRuntimeDeps (const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
 
bool addXRayRuntime (const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
 
void linkXRayRuntimeDeps (const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
 
void AddRunTimeLibs (const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
 
void AddStaticDeviceLibsLinking (Compilation &C, const Tool &T, const JobAction &JA, const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
 
void AddStaticDeviceLibsPostLinking (const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
 
void AddStaticDeviceLibs (Compilation *C, const Tool *T, const JobAction *JA, const InputInfoList *Inputs, const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
 
bool SDLSearch (const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, SmallVector< std::string, 8 > LibraryPaths, std::string Lib, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
 SDLSearch: Search for Static Device Library The search for SDL bitcode files is consistent with how static host libraries are discovered. More...
 
bool GetSDLFromOffloadArchive (Compilation &C, const Driver &D, const Tool &T, const JobAction &JA, const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, SmallVector< std::string, 8 > LibraryPaths, StringRef Lib, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
 Search if a user provided archive file lib<libname>.a exists in any of the library paths. More...
 
const char * SplitDebugName (const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Input, const InputInfo &Output)
 
void SplitDebugInfo (const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
 
void addLTOOptions (const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
 
std::tuple< llvm::Reloc::Model, unsigned, boolParsePICArgs (const ToolChain &ToolChain, const llvm::opt::ArgList &Args)
 
unsigned ParseFunctionAlignment (const ToolChain &TC, const llvm::opt::ArgList &Args)
 
unsigned ParseDebugDefaultVersion (const ToolChain &TC, const llvm::opt::ArgList &Args)
 
void AddAssemblerKPIC (const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
 
void addArchSpecificRPath (const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
 
bool addOpenMPRuntime (llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args, bool ForceStaticHostRuntime=false, bool IsOffloadingHost=false, bool GompNeedsRT=false)
 Returns true, if an OpenMP runtime has been added. More...
 
llvm::opt::Arg * getLastProfileUseArg (const llvm::opt::ArgList &Args)
 
llvm::opt::Arg * getLastProfileSampleUseArg (const llvm::opt::ArgList &Args)
 
bool isObjCAutoRefCount (const llvm::opt::ArgList &Args)
 
llvm::StringRef getLTOParallelism (const llvm::opt::ArgList &Args, const Driver &D)
 
bool areOptimizationsEnabled (const llvm::opt::ArgList &Args)
 
bool isUseSeparateSections (const llvm::Triple &Triple)
 
void addDirectoryList (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const char *ArgName, const char *EnvVar)
 EnvVar is split by system delimiter for environment variables. More...
 
void AddTargetFeature (const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier OnOpt, llvm::opt::OptSpecifier OffOpt, StringRef FeatureName)
 
std::string getCPUName (const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
 
void handleTargetFeaturesGroup (const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier Group)
 Iterate Args and convert -mxxx to +xxx and -mno-xxx to -xxx and append it to Features. More...
 
std::vector< StringRef > unifyTargetFeatures (const std::vector< StringRef > &Features)
 If there are multiple +xxx or -xxx features, keep the last one. More...
 
SmallString< 128 > getStatsFileName (const llvm::opt::ArgList &Args, const InputInfo &Output, const InputInfo &Input, const Driver &D)
 Handles the -save-stats option and returns the filename to save statistics to. More...
 
void addMultilibFlag (bool Enabled, const char *const Flag, Multilib::flags_list &Flags)
 Flag must be a flag accepted by the driver with its leading '-' removed, More...
 
void addX86AlignBranchArgs (const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool IsLTO)
 
void checkAMDGPUCodeObjectVersion (const Driver &D, const llvm::opt::ArgList &Args)
 
unsigned getAMDGPUCodeObjectVersion (const Driver &D, const llvm::opt::ArgList &Args)
 
bool haveAMDGPUCodeObjectVersionArgument (const Driver &D, const llvm::opt::ArgList &Args)
 
void addMachineOutlinerArgs (const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple, bool IsLTO)
 
void addOpenMPDeviceRTL (const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, StringRef BitcodeSuffix, const llvm::Triple &Triple)
 

Function Documentation

◆ addArchSpecificRPath()

void clang::driver::tools::addArchSpecificRPath ( const ToolChain TC,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ AddAssemblerKPIC()

void clang::driver::tools::AddAssemblerKPIC ( const ToolChain ToolChain,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ addDirectoryList()

void clang::driver::tools::addDirectoryList ( const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs,
const char *  ArgName,
const char *  EnvVar 
)

EnvVar is split by system delimiter for environment variables.

If ArgName is "-I", "-L", or an empty string, each entry from EnvVar is prefixed by ArgName then added to Args. Otherwise, for each entry of EnvVar, ArgName is added to Args first, then the entry itself is added.

Referenced by clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), and clang::driver::toolchains::HIPToolChain::getHIPDeviceLibs().

◆ addLinkerCompressDebugSectionsOption()

void clang::driver::tools::addLinkerCompressDebugSectionsOption ( const ToolChain TC,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ AddLinkerInputs()

void clang::driver::tools::AddLinkerInputs ( const ToolChain TC,
const InputInfoList Inputs,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs,
const JobAction JA 
)

◆ addLTOOptions()

void clang::driver::tools::addLTOOptions ( const ToolChain ToolChain,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs,
const InputInfo Output,
const InputInfo Input,
bool  IsThinLTO 
)

◆ addMachineOutlinerArgs()

void clang::driver::tools::addMachineOutlinerArgs ( const Driver D,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs,
const llvm::Triple &  Triple,
bool  IsLTO 
)

Definition at line 1935 of file CommonArgs.cpp.

References clang::driver::Driver::Diag().

◆ addMultilibFlag()

void clang::driver::tools::addMultilibFlag ( bool  Enabled,
const char *const  Flag,
Multilib::flags_list Flags 
)

Flag must be a flag accepted by the driver with its leading '-' removed,

Definition at line 1536 of file CommonArgs.cpp.

References string().

Referenced by findAndroidArmMultilibs(), findBiarchMultilibs(), findMSP430Multilibs(), findRISCVBareMetalMultilibs(), findRISCVMultilibs(), and clang::driver::toolchains::Fuchsia::Fuchsia().

◆ addOpenMPDeviceRTL()

void clang::driver::tools::addOpenMPDeviceRTL ( const Driver D,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args,
StringRef  BitcodeSuffix,
const llvm::Triple &  Triple 
)

◆ addOpenMPRuntime()

bool clang::driver::tools::addOpenMPRuntime ( llvm::opt::ArgStringList &  CmdArgs,
const ToolChain TC,
const llvm::opt::ArgList &  Args,
bool  ForceStaticHostRuntime = false,
bool  IsOffloadingHost = false,
bool  GompNeedsRT = false 
)

◆ addPathIfExists()

void clang::driver::tools::addPathIfExists ( const Driver D,
const Twine &  Path,
ToolChain::path_list Paths 
)

◆ AddRunTimeLibs()

void clang::driver::tools::AddRunTimeLibs ( const ToolChain TC,
const Driver D,
llvm::opt::ArgStringList &  CmdArgs,
const llvm::opt::ArgList &  Args 
)

◆ addSanitizerRuntimes()

bool clang::driver::tools::addSanitizerRuntimes ( const ToolChain TC,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ AddStaticDeviceLibs()

void clang::driver::tools::AddStaticDeviceLibs ( Compilation C,
const Tool T,
const JobAction JA,
const InputInfoList Inputs,
const Driver D,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CmdArgs,
StringRef  Arch,
StringRef  Target,
bool  isBitCodeSDL,
bool  postClangLink 
)

◆ AddStaticDeviceLibsLinking()

void clang::driver::tools::AddStaticDeviceLibsLinking ( Compilation C,
const Tool T,
const JobAction JA,
const InputInfoList Inputs,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CmdArgs,
StringRef  Arch,
StringRef  Target,
bool  isBitCodeSDL,
bool  postClangLink 
)

◆ AddStaticDeviceLibsPostLinking()

void clang::driver::tools::AddStaticDeviceLibsPostLinking ( const Driver D,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CmdArgs,
StringRef  Arch,
StringRef  Target,
bool  isBitCodeSDL,
bool  postClangLink 
)

◆ AddTargetFeature()

void clang::driver::tools::AddTargetFeature ( const llvm::opt::ArgList &  Args,
std::vector< StringRef > &  Features,
llvm::opt::OptSpecifier  OnOpt,
llvm::opt::OptSpecifier  OffOpt,
StringRef  FeatureName 
)

◆ addX86AlignBranchArgs()

void clang::driver::tools::addX86AlignBranchArgs ( const Driver D,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs,
bool  IsLTO 
)

◆ addXRayRuntime()

bool clang::driver::tools::addXRayRuntime ( const ToolChain TC,
const llvm::opt::ArgList &  Args,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ areOptimizationsEnabled()

bool clang::driver::tools::areOptimizationsEnabled ( const llvm::opt::ArgList &  Args)

◆ checkAMDGPUCodeObjectVersion()

void clang::driver::tools::checkAMDGPUCodeObjectVersion ( const Driver D,
const llvm::opt::ArgList &  Args 
)

◆ claimNoWarnArgs()

void clang::driver::tools::claimNoWarnArgs ( const llvm::opt::ArgList &  Args)

◆ getAMDGPUCodeObjectVersion()

unsigned clang::driver::tools::getAMDGPUCodeObjectVersion ( const Driver D,
const llvm::opt::ArgList &  Args 
)

◆ getCPUName()

std::string clang::driver::tools::getCPUName ( const Driver D,
const llvm::opt::ArgList &  Args,
const llvm::Triple &  T,
bool  FromAs = false 
)

◆ getLastProfileSampleUseArg()

llvm::opt::Arg* clang::driver::tools::getLastProfileSampleUseArg ( const llvm::opt::ArgList &  Args)

Referenced by addPGOAndCoverageFlags().

◆ getLastProfileUseArg()

llvm::opt::Arg* clang::driver::tools::getLastProfileUseArg ( const llvm::opt::ArgList &  Args)

◆ getLTOParallelism()

llvm::StringRef clang::driver::tools::getLTOParallelism ( const llvm::opt::ArgList &  Args,
const Driver D 
)

◆ GetSDLFromOffloadArchive()

bool clang::driver::tools::GetSDLFromOffloadArchive ( Compilation C,
const Driver D,
const Tool T,
const JobAction JA,
const InputInfoList Inputs,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args,
SmallVector< std::string, 8 >  LibraryPaths,
StringRef  Lib,
StringRef  Arch,
StringRef  Target,
bool  isBitCodeSDL,
bool  postClangLink 
)

Search if a user provided archive file lib<libname>.a exists in any of the library paths.

If so, add a new command to clang-offload-bundler to unbundle this archive and create a temporary device specific archive. Name of this SDL is passed to the llvm-link (for amdgcn) or to the clang-nvlink-wrapper (for nvptx) commands by the driver.

Definition at line 1692 of file CommonArgs.cpp.

References clang::driver::ResponseFileSupport::AtFileCurCP(), clang::driver::Action::getOffloadingDeviceKind(), clang::driver::Action::GetOffloadKindName(), clang::driver::ToolChain::GetProgramPath(), clang::driver::Driver::GetTemporaryPath(), clang::driver::Tool::getToolChain(), clang::driver::ToolChain::getTriple(), string(), and clang::Target.

Referenced by AddStaticDeviceLibs().

◆ getStatsFileName()

SmallString< 128 > clang::driver::tools::getStatsFileName ( const llvm::opt::ArgList &  Args,
const InputInfo Output,
const InputInfo Input,
const Driver D 
)

Handles the -save-stats option and returns the filename to save statistics to.

Definition at line 1512 of file CommonArgs.cpp.

References clang::driver::Driver::Diag(), clang::driver::InputInfo::getBaseInput(), clang::driver::InputInfo::getFilename(), and clang::driver::InputInfo::isFilename().

Referenced by clang::driver::tools::darwin::Linker::ConstructJob().

◆ handleTargetFeaturesGroup()

void clang::driver::tools::handleTargetFeaturesGroup ( const llvm::opt::ArgList &  Args,
std::vector< StringRef > &  Features,
llvm::opt::OptSpecifier  Group 
)

Iterate Args and convert -mxxx to +xxx and -mno-xxx to -xxx and append it to Features.

Note: Since Features may contain default values before calling this function, or may be appended with entries to override arguments, entries in Features are not unique.

Referenced by clang::driver::tools::amdgpu::getAMDGPUTargetFeatures(), and getWebAssemblyTargetFeatures().

◆ haveAMDGPUCodeObjectVersionArgument()

bool clang::driver::tools::haveAMDGPUCodeObjectVersionArgument ( const Driver D,
const llvm::opt::ArgList &  Args 
)

Definition at line 1930 of file CommonArgs.cpp.

References getAMDGPUCodeObjectArgument().

Referenced by handleAMDGPUCodeObjectVersionOptions().

◆ isObjCAutoRefCount()

bool clang::driver::tools::isObjCAutoRefCount ( const llvm::opt::ArgList &  Args)

◆ isUseSeparateSections()

bool clang::driver::tools::isUseSeparateSections ( const llvm::Triple &  Triple)

Definition at line 479 of file CommonArgs.cpp.

Referenced by clang::driver::tools::Clang::ConstructJob().

◆ linkSanitizerRuntimeDeps()

void clang::driver::tools::linkSanitizerRuntimeDeps ( const ToolChain TC,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ linkXRayRuntimeDeps()

void clang::driver::tools::linkXRayRuntimeDeps ( const ToolChain TC,
llvm::opt::ArgStringList &  CmdArgs 
)

◆ ParseDebugDefaultVersion()

unsigned clang::driver::tools::ParseDebugDefaultVersion ( const ToolChain TC,
const llvm::opt::ArgList &  Args 
)

◆ ParseFunctionAlignment()

unsigned clang::driver::tools::ParseFunctionAlignment ( const ToolChain TC,
const llvm::opt::ArgList &  Args 
)

◆ ParsePICArgs()

std::tuple<llvm::Reloc::Model, unsigned, bool> clang::driver::tools::ParsePICArgs ( const ToolChain ToolChain,
const llvm::opt::ArgList &  Args 
)

◆ SDLSearch()

bool clang::driver::tools::SDLSearch ( const Driver D,
const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args,
SmallVector< std::string, 8 >  LibraryPaths,
std::string  Lib,
StringRef  Arch,
StringRef  Target,
bool  isBitCodeSDL,
bool  postClangLink 
)

SDLSearch: Search for Static Device Library The search for SDL bitcode files is consistent with how static host libraries are discovered.

That is, the -l option triggers a search for files in a set of directories called the LINKPATH. The host library search procedure looks for a specific filename in the LINKPATH. The filename for a host library is lib<libname>.a or lib<libname>.so. For SDLs, there is an ordered-set of filenames that are searched. We call this ordered-set of filenames as SEARCH-ORDER. Since an SDL can either be device-type specific, architecture specific, or generic across all architectures, a naming convention and search order is used where the file name embeds the architecture name <arch-name> (nvptx or amdgcn) and the GPU device type <device-name> such as sm_30 and gfx906. <device-name> is absent in case of device-independent SDLs. To reduce congestion in host library directories, the search first looks for files in the “libdevice” subdirectory. SDLs that are bc files begin with the prefix “lib”.

Machine-code SDLs can also be managed as an archive (*.a file). The convention has been to use the prefix “lib”. To avoid confusion with host archive libraries, we use prefix "libbc-" for the bitcode SDL archives.

Definition at line 1611 of file CommonArgs.cpp.

References string(), and clang::Target.

Referenced by AddStaticDeviceLibs().

◆ SplitDebugInfo()

void clang::driver::tools::SplitDebugInfo ( const ToolChain TC,
Compilation C,
const Tool T,
const JobAction JA,
const llvm::opt::ArgList &  Args,
const InputInfo Output,
const char *  OutFile 
)

◆ SplitDebugName()

const char* clang::driver::tools::SplitDebugName ( const JobAction JA,
const llvm::opt::ArgList &  Args,
const InputInfo Input,
const InputInfo Output 
)

◆ unifyTargetFeatures()

std::vector< StringRef > clang::driver::tools::unifyTargetFeatures ( const std::vector< StringRef > &  Features)

If there are multiple +xxx or -xxx features, keep the last one.

Definition at line 147 of file CommonArgs.cpp.

Referenced by getTargetFeatures().