clang 24.0.0git
CommonArgs.cpp File Reference
#include "clang/Driver/CommonArgs.h"
#include "Arch/AArch64.h"
#include "Arch/ARM.h"
#include "Arch/CSKY.h"
#include "Arch/LoongArch.h"
#include "Arch/M68k.h"
#include "Arch/Mips.h"
#include "Arch/PPC.h"
#include "Arch/RISCV.h"
#include "Arch/Sparc.h"
#include "Arch/SystemZ.h"
#include "Arch/VE.h"
#include "Arch/X86.h"
#include "HIPAMD.h"
#include "Hexagon.h"
#include "MSP430.h"
#include "Solaris.h"
#include "ToolChains/Cuda.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Config/config.h"
#include "clang/Driver/Action.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/InputInfo.h"
#include "clang/Driver/Job.h"
#include "clang/Driver/SanitizerArgs.h"
#include "clang/Driver/ToolChain.h"
#include "clang/Driver/Util.h"
#include "clang/Driver/XRayArgs.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Options/Options.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Threading.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/TargetParser/AMDGPUTargetParser.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/PPCTargetParser.h"
#include <optional>

Go to the source code of this file.

Enumerations

enum class  LibGccType { UnspecifiedLibGcc , StaticLibGcc , SharedLibGcc }

Functions

static bool useFramePointerForTargetByDefault (const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
static bool useLeafFramePointerForTargetByDefault (const llvm::Triple &Triple)
static bool mustUseNonLeafFramePointerForTarget (const llvm::Triple &Triple)
static bool mustMaintainValidFrameChain (const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
static bool framePointerImpliesLeafFramePointer (const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
clang::CodeGenOptions::FramePointerKind getFramePointerKind (const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
static void renderRpassOptions (const ArgList &Args, ArgStringList &CmdArgs, const StringRef PluginOptPrefix)
static void renderRemarksOptions (const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple, const InputInfo &Input, const InputInfo &Output, const StringRef PluginOptPrefix)
static void renderRemarksHotnessOptions (const ArgList &Args, ArgStringList &CmdArgs, const StringRef PluginOptPrefix)
static bool shouldIgnoreUnsupportedTargetFeature (const Arg &TargetFeatureArg, const llvm::Triple &T)
static StringRef getAMDGPUTargetGPU (const llvm::Triple &T, const ArgList &Args)
 Get the (LLVM) name of the AMDGPU gpu we are targeting.
static std::string getLanaiTargetCPU (const ArgList &Args)
static StringRef getWebAssemblyTargetCPU (const ArgList &Args)
 Get the (LLVM) name of the WebAssembly cpu we are targeting.
static void getWebAssemblyTargetFeatures (const Driver &D, const llvm::Triple &Triple, const ArgList &Args, std::vector< StringRef > &Features)
static void addSanitizerRuntime (const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs, StringRef Sanitizer, bool IsShared, bool IsWhole)
static bool addSanitizerDynamicList (const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs, StringRef Sanitizer)
static bool hostNeedsUbsanOffloadRt (Compilation &C, const ToolChain &HostTC)
static void collectSanitizerRuntimes (Compilation &C, const ToolChain &TC, const ArgList &Args, SmallVectorImpl< StringRef > &SharedRuntimes, SmallVectorImpl< StringRef > &StaticRuntimes, SmallVectorImpl< StringRef > &NonWholeStaticRuntimes, SmallVectorImpl< StringRef > &HelperStaticRuntimes, SmallVectorImpl< StringRef > &RequiredSymbols)
static unsigned ParseDebugDefaultVersion (const ToolChain &TC, const ArgList &Args)
static LibGccType getLibGccType (const ToolChain &TC, const Driver &D, const ArgList &Args)
static void AddUnwindLibrary (const ToolChain &TC, const Driver &D, ArgStringList &CmdArgs, const ArgList &Args)
static void AddLibgcc (const ToolChain &TC, const Driver &D, ArgStringList &CmdArgs, const ArgList &Args)
static llvm::opt::Arg * getAMDGPUCodeObjectArgument (const Driver &D, const llvm::opt::ArgList &Args)
static void emitComplexRangeDiag (const Driver &D, StringRef LastOpt, LangOptions::ComplexRangeKind Range, StringRef NewOpt, LangOptions::ComplexRangeKind NewRange)

Enumeration Type Documentation

◆ LibGccType

enum class LibGccType
strong
Enumerator
UnspecifiedLibGcc 
StaticLibGcc 
SharedLibGcc 

Definition at line 2494 of file CommonArgs.cpp.

Function Documentation

◆ AddLibgcc()

◆ addSanitizerDynamicList()

bool addSanitizerDynamicList ( const ToolChain & TC,
const ArgList & Args,
ArgStringList & CmdArgs,
StringRef Sanitizer )
static

◆ addSanitizerRuntime()

void addSanitizerRuntime ( const ToolChain & TC,
const ArgList & Args,
ArgStringList & CmdArgs,
StringRef Sanitizer,
bool IsShared,
bool IsWhole )
static

◆ AddUnwindLibrary()

◆ collectSanitizerRuntimes()

void collectSanitizerRuntimes ( Compilation & C,
const ToolChain & TC,
const ArgList & Args,
SmallVectorImpl< StringRef > & SharedRuntimes,
SmallVectorImpl< StringRef > & StaticRuntimes,
SmallVectorImpl< StringRef > & NonWholeStaticRuntimes,
SmallVectorImpl< StringRef > & HelperStaticRuntimes,
SmallVectorImpl< StringRef > & RequiredSymbols )
static

◆ emitComplexRangeDiag()

void emitComplexRangeDiag ( const Driver & D,
StringRef LastOpt,
LangOptions::ComplexRangeKind Range,
StringRef NewOpt,
LangOptions::ComplexRangeKind NewRange )
static

◆ framePointerImpliesLeafFramePointer()

bool framePointerImpliesLeafFramePointer ( const llvm::opt::ArgList & Args,
const llvm::Triple & Triple )
static

Definition at line 223 of file CommonArgs.cpp.

References V.

Referenced by getFramePointerKind().

◆ getAMDGPUCodeObjectArgument()

llvm::opt::Arg * getAMDGPUCodeObjectArgument ( const Driver & D,
const llvm::opt::ArgList & Args )
static

◆ getAMDGPUTargetGPU()

StringRef getAMDGPUTargetGPU ( const llvm::Triple & T,
const ArgList & Args )
static

Get the (LLVM) name of the AMDGPU gpu we are targeting.

Definition at line 728 of file CommonArgs.cpp.

References clang::getProcessorFromTargetID(), and clang::T.

◆ getFramePointerKind()

◆ getLanaiTargetCPU()

std::string getLanaiTargetCPU ( const ArgList & Args)
static

Definition at line 747 of file CommonArgs.cpp.

◆ getLibGccType()

LibGccType getLibGccType ( const ToolChain & TC,
const Driver & D,
const ArgList & Args )
static

◆ getWebAssemblyTargetCPU()

StringRef getWebAssemblyTargetCPU ( const ArgList & Args)
static

Get the (LLVM) name of the WebAssembly cpu we are targeting.

Definition at line 755 of file CommonArgs.cpp.

◆ getWebAssemblyTargetFeatures()

void getWebAssemblyTargetFeatures ( const Driver & D,
const llvm::Triple & Triple,
const ArgList & Args,
std::vector< StringRef > & Features )
static

Definition at line 885 of file CommonArgs.cpp.

References clang::driver::tools::handleTargetFeaturesGroup().

◆ hostNeedsUbsanOffloadRt()

◆ mustMaintainValidFrameChain()

bool mustMaintainValidFrameChain ( const llvm::opt::ArgList & Args,
const llvm::Triple & Triple )
static

Definition at line 195 of file CommonArgs.cpp.

References V.

Referenced by getFramePointerKind().

◆ mustUseNonLeafFramePointerForTarget()

bool mustUseNonLeafFramePointerForTarget ( const llvm::Triple & Triple)
static

Definition at line 181 of file CommonArgs.cpp.

Referenced by getFramePointerKind().

◆ ParseDebugDefaultVersion()

unsigned ParseDebugDefaultVersion ( const ToolChain & TC,
const ArgList & Args )
static

◆ renderRemarksHotnessOptions()

void renderRemarksHotnessOptions ( const ArgList & Args,
ArgStringList & CmdArgs,
const StringRef PluginOptPrefix )
static

Definition at line 361 of file CommonArgs.cpp.

◆ renderRemarksOptions()

void renderRemarksOptions ( const ArgList & Args,
ArgStringList & CmdArgs,
const llvm::Triple & Triple,
const InputInfo & Input,
const InputInfo & Output,
const StringRef PluginOptPrefix )
static

◆ renderRpassOptions()

void renderRpassOptions ( const ArgList & Args,
ArgStringList & CmdArgs,
const StringRef PluginOptPrefix )
static

Definition at line 310 of file CommonArgs.cpp.

◆ shouldIgnoreUnsupportedTargetFeature()

bool shouldIgnoreUnsupportedTargetFeature ( const Arg & TargetFeatureArg,
const llvm::Triple & T )
static

Definition at line 376 of file CommonArgs.cpp.

References clang::T.

◆ useFramePointerForTargetByDefault()

bool useFramePointerForTargetByDefault ( const llvm::opt::ArgList & Args,
const llvm::Triple & Triple )
static

◆ useLeafFramePointerForTargetByDefault()

bool useLeafFramePointerForTargetByDefault ( const llvm::Triple & Triple)
static

Definition at line 170 of file CommonArgs.cpp.

Referenced by getFramePointerKind().