clang API Documentation

Public Types | Public Member Functions | Protected Member Functions
clang::driver::ToolChain Class Reference

ToolChain - Access to tools for a single platform. More...

#include <ToolChain.h>

Inheritance diagram for clang::driver::ToolChain:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CXXStdlibType { CST_Libcxx, CST_Libstdcxx }
enum  RuntimeLibType { RLT_CompilerRT, RLT_Libgcc }
typedef SmallVector
< std::string, 4 > 
path_list

Public Member Functions

virtual ~ToolChain ()
const DrivergetDriver () const
const llvm::Triple & getTriple () const
llvm::Triple::ArchType getArch () const
StringRef getArchName () const
StringRef getPlatform () const
StringRef getOS () const
std::string getTripleString () const
path_listgetFilePaths ()
const path_listgetFilePaths () const
path_listgetProgramPaths ()
const path_listgetProgramPaths () const
virtual DerivedArgListTranslateArgs (const DerivedArgList &Args, const char *BoundArch) const
virtual ToolSelectTool (const Compilation &C, const JobAction &JA, const ActionList &Inputs) const =0
std::string GetFilePath (const char *Name) const
std::string GetProgramPath (const char *Name, bool WantFile=false) const
virtual bool HasNativeLLVMSupport () const
virtual types::ID LookupTypeForExtension (const char *Ext) const
virtual bool IsBlocksDefault () const
 IsBlocksDefault - Does this tool chain enable -fblocks by default.
virtual bool IsIntegratedAssemblerDefault () const
virtual bool IsStrictAliasingDefault () const
virtual bool IsObjCDefaultSynthPropertiesDefault () const
virtual bool IsObjCNonFragileABIDefault () const
virtual bool IsObjCLegacyDispatchDefault () const
virtual bool UseObjCMixedDispatch () const
virtual unsigned GetDefaultStackProtectorLevel (bool KernelOrKext) const
virtual RuntimeLibType GetDefaultRuntimeLibType () const
 GetDefaultRuntimeLibType - Get the default runtime library variant to use.
virtual bool IsUnwindTablesDefault () const =0
virtual const char * GetDefaultRelocationModel () const =0
virtual const char * GetForcedPicModel () const =0
virtual bool SupportsProfiling () const
 SupportsProfiling - Does this tool chain support -pg.
virtual bool SupportsObjCGC () const
 Does this tool chain support Objective-C garbage collection.
virtual bool UseDwarfDebugFlags () const
virtual bool UseSjLjExceptions () const
 UseSjLjExceptions - Does this tool chain use SjLj exceptions.
virtual std::string ComputeLLVMTriple (const ArgList &Args, types::ID InputType=types::TY_INVALID) const
virtual std::string ComputeEffectiveClangTriple (const ArgList &Args, types::ID InputType=types::TY_INVALID) const
virtual void configureObjCRuntime (ObjCRuntime &runtime) const
virtual bool hasBlocksRuntime () const
virtual void AddClangSystemIncludeArgs (const ArgList &DriverArgs, ArgStringList &CC1Args) const
 Add the clang cc1 arguments for system include paths.
virtual RuntimeLibType GetRuntimeLibType (const ArgList &Args) const
virtual CXXStdlibType GetCXXStdlibType (const ArgList &Args) const
virtual void AddClangCXXStdlibIncludeArgs (const ArgList &DriverArgs, ArgStringList &CC1Args) const
virtual void AddCXXStdlibLibArgs (const ArgList &Args, ArgStringList &CmdArgs) const
virtual void AddCCKextLibArgs (const ArgList &Args, ArgStringList &CmdArgs) const

Protected Member Functions

 ToolChain (const Driver &D, const llvm::Triple &T)

Static Protected Member Functions

Utilities for implementing subclasses.
static void addSystemInclude (const ArgList &DriverArgs, ArgStringList &CC1Args, const Twine &Path)
 Utility function to add a system include directory to CC1 arguments.
static void addExternCSystemInclude (const ArgList &DriverArgs, ArgStringList &CC1Args, const Twine &Path)
 Utility function to add a system include directory with extern "C" semantics to CC1 arguments.
static void addSystemIncludes (const ArgList &DriverArgs, ArgStringList &CC1Args, ArrayRef< StringRef > Paths)
 Utility function to add a list of system include directories to CC1.

Detailed Description

ToolChain - Access to tools for a single platform.

Definition at line 32 of file ToolChain.h.


Member Typedef Documentation

typedef SmallVector<std::string, 4> clang::driver::ToolChain::path_list

Definition at line 34 of file ToolChain.h.


Member Enumeration Documentation

Enumerator:
CST_Libcxx 
CST_Libstdcxx 

Definition at line 36 of file ToolChain.h.

Enumerator:
RLT_CompilerRT 
RLT_Libgcc 

Definition at line 41 of file ToolChain.h.


Constructor & Destructor Documentation

ToolChain::ToolChain ( const Driver D,
const llvm::Triple &  T 
) [protected]

Definition at line 23 of file ToolChain.cpp.

ToolChain::~ToolChain ( ) [virtual]

Definition at line 27 of file ToolChain.cpp.


Member Function Documentation

void ToolChain::AddCCKextLibArgs ( const ArgList Args,
ArgStringList CmdArgs 
) const [virtual]

AddCCKextLibArgs - Add the system specific linker arguments to use for kernel extensions (Darwin-specific).

Reimplemented in clang::driver::toolchains::DarwinClang.

Definition at line 311 of file ToolChain.cpp.

Referenced by AddLinkerInputs().

void ToolChain::AddClangCXXStdlibIncludeArgs ( const ArgList DriverArgs,
ArgStringList CC1Args 
) const [virtual]

AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for the given C++ standard library type.

Reimplemented in clang::driver::toolchains::Windows, and clang::driver::toolchains::Linux.

Definition at line 282 of file ToolChain.cpp.

References clang::driver::ArgList::AddAllArgs().

void ToolChain::AddClangSystemIncludeArgs ( const ArgList DriverArgs,
ArgStringList CC1Args 
) const [virtual]

Add the clang cc1 arguments for system include paths.

This routine is responsible for adding the necessary cc1 arguments to include headers from standard system header directories.

Reimplemented in clang::driver::toolchains::Windows, and clang::driver::toolchains::Linux.

Definition at line 213 of file ToolChain.cpp.

void ToolChain::AddCXXStdlibLibArgs ( const ArgList Args,
ArgStringList CmdArgs 
) const [virtual]

AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard library type.

Reimplemented in clang::driver::toolchains::DarwinClang.

Definition at line 296 of file ToolChain.cpp.

References CST_Libcxx, CST_Libstdcxx, and GetCXXStdlibType().

Referenced by AddLinkerInputs(), and clang::driver::tools::linuxtools::Link::ConstructJob().

void ToolChain::addExternCSystemInclude ( const ArgList DriverArgs,
ArgStringList CC1Args,
const Twine &  Path 
) [static, protected]

Utility function to add a system include directory with extern "C" semantics to CC1 arguments.

Note that this should be used rarely, and only for directories that historically and for legacy reasons are treated as having implicit extern "C" semantics. These semantics are *ignored* by and large today, but its important to preserve the preprocessor changes resulting from the classification.

Definition at line 264 of file ToolChain.cpp.

References clang::driver::ArgList::MakeArgString().

Referenced by clang::driver::toolchains::Linux::AddClangSystemIncludeArgs().

void ToolChain::addSystemInclude ( const ArgList DriverArgs,
ArgStringList CC1Args,
const Twine &  Path 
) [static, protected]
void ToolChain::addSystemIncludes ( const ArgList DriverArgs,
ArgStringList CC1Args,
ArrayRef< StringRef >  Paths 
) [static, protected]

Utility function to add a list of system include directories to CC1.

Definition at line 272 of file ToolChain.cpp.

References clang::driver::ArgList::MakeArgString().

Referenced by clang::driver::toolchains::Windows::AddClangSystemIncludeArgs().

std::string ToolChain::ComputeEffectiveClangTriple ( const ArgList Args,
types::ID  InputType = types::TY_INVALID 
) const [virtual]

ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into account the command line arguments. For example, on Darwin the -mmacosx-version-min= command line argument (which sets the deployment target) determines the version in the triple passed to Clang.

Reimplemented in clang::driver::toolchains::Darwin_Generic_GCC, and clang::driver::toolchains::Darwin.

Definition at line 201 of file ToolChain.cpp.

References ComputeLLVMTriple(), clang::driver::Driver::Diag(), getDriver(), and clang::driver::ArgList::getLastArg().

std::string ToolChain::ComputeLLVMTriple ( const ArgList Args,
types::ID  InputType = types::TY_INVALID 
) const [virtual]
void ToolChain::configureObjCRuntime ( ObjCRuntime runtime) const [virtual]

configureObjCRuntime - Configure the known properties of the Objective-C runtime for this platform.

FIXME: this really belongs on some sort of DeploymentTarget abstraction

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 51 of file ToolChain.cpp.

References clang::driver::ObjCRuntime::getKind(), clang::driver::ObjCRuntime::GNU, clang::driver::ObjCRuntime::HasARC, clang::driver::ObjCRuntime::HasTerminate, clang::driver::ObjCRuntime::HasWeak, and clang::driver::ObjCRuntime::NeXT.

Referenced by clang::driver::toolchains::Darwin::configureObjCRuntime().

llvm::Triple::ArchType clang::driver::ToolChain::getArch ( ) const [inline]
StringRef clang::driver::ToolChain::getArchName ( ) const [inline]
ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType ( const ArgList Args) const [virtual]
virtual const char* clang::driver::ToolChain::GetDefaultRelocationModel ( ) const [pure virtual]
virtual RuntimeLibType clang::driver::ToolChain::GetDefaultRuntimeLibType ( ) const [inline, virtual]

GetDefaultRuntimeLibType - Get the default runtime library variant to use.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 164 of file ToolChain.h.

References RLT_Libgcc.

Referenced by GetRuntimeLibType().

virtual unsigned clang::driver::ToolChain::GetDefaultStackProtectorLevel ( bool  KernelOrKext) const [inline, virtual]

GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off, 1=on, 2=all).

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 159 of file ToolChain.h.

const Driver & ToolChain::getDriver ( ) const

Definition at line 30 of file ToolChain.cpp.

Referenced by addAsanRTLinux(), clang::driver::toolchains::DarwinClang::AddCCKextLibArgs(), clang::driver::toolchains::Linux::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::Linux::AddClangSystemIncludeArgs(), clang::driver::toolchains::Windows::AddClangSystemIncludeArgs(), clang::driver::toolchains::DarwinClang::AddLinkARCArgs(), AddLinkerInputs(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLib(), clang::driver::toolchains::DarwinClang::AddLinkRuntimeLibArgs(), clang::driver::toolchains::DarwinClang::AddLinkSearchPathArgs(), addProfileRT(), clang::driver::toolchains::AuroraUX::AuroraUX(), ComputeEffectiveClangTriple(), clang::driver::tools::linuxtools::Link::ConstructJob(), clang::driver::toolchains::Darwin::Darwin(), clang::driver::toolchains::DarwinClang::DarwinClang(), clang::driver::toolchains::DragonFly::DragonFly(), clang::driver::toolchains::FreeBSD::FreeBSD(), clang::driver::toolchains::Generic_GCC::Generic_GCC(), GetCXXStdlibType(), GetRuntimeLibType(), clang::driver::toolchains::Hexagon_TC::Hexagon_TC(), clang::driver::toolchains::Linux::Linux(), clang::driver::toolchains::Minix::Minix(), clang::driver::toolchains::NetBSD::NetBSD(), clang::driver::toolchains::OpenBSD::OpenBSD(), clang::driver::toolchains::Generic_GCC::SelectTool(), clang::driver::toolchains::Hexagon_TC::SelectTool(), clang::driver::toolchains::Darwin::SelectTool(), clang::driver::toolchains::AuroraUX::SelectTool(), clang::driver::toolchains::OpenBSD::SelectTool(), clang::driver::toolchains::FreeBSD::SelectTool(), clang::driver::toolchains::NetBSD::SelectTool(), clang::driver::toolchains::Minix::SelectTool(), clang::driver::toolchains::DragonFly::SelectTool(), clang::driver::toolchains::Linux::SelectTool(), clang::driver::toolchains::Windows::SelectTool(), clang::driver::toolchains::TCEToolChain::TCEToolChain(), and clang::driver::toolchains::Darwin::TranslateArgs().

std::string ToolChain::GetFilePath ( const char *  Name) const
path_list& clang::driver::ToolChain::getFilePaths ( ) [inline]
const path_list& clang::driver::ToolChain::getFilePaths ( ) const [inline]

Definition at line 92 of file ToolChain.h.

virtual const char* clang::driver::ToolChain::GetForcedPicModel ( ) const [pure virtual]

GetForcedPicModel - Return the LLVM name of the forced PIC model for this tool chain, or 0 if this tool chain does not force a particular PIC mode.

Implemented in clang::driver::toolchains::Windows, clang::driver::toolchains::TCEToolChain, clang::driver::toolchains::Darwin, clang::driver::toolchains::Hexagon_TC, and clang::driver::toolchains::Generic_GCC.

StringRef clang::driver::ToolChain::getOS ( ) const [inline]
StringRef clang::driver::ToolChain::getPlatform ( ) const [inline]

Definition at line 84 of file ToolChain.h.

std::string ToolChain::GetProgramPath ( const char *  Name,
bool  WantFile = false 
) const
path_list& clang::driver::ToolChain::getProgramPaths ( ) [inline]
const path_list& clang::driver::ToolChain::getProgramPaths ( ) const [inline]

Definition at line 95 of file ToolChain.h.

ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType ( const ArgList Args) const [virtual]
const llvm::Triple& clang::driver::ToolChain::getTriple ( ) const [inline]
std::string clang::driver::ToolChain::getTripleString ( ) const [inline]
virtual bool clang::driver::ToolChain::hasBlocksRuntime ( ) const [inline, virtual]

hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the existence of a blocks runtime?

FIXME: this really belongs on some sort of DeploymentTarget abstraction

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 218 of file ToolChain.h.

bool ToolChain::HasNativeLLVMSupport ( ) const [virtual]

HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.

Reimplemented in clang::driver::toolchains::Linux, and clang::driver::toolchains::Darwin.

Definition at line 47 of file ToolChain.cpp.

Referenced by AddLinkerInputs().

virtual bool clang::driver::ToolChain::IsBlocksDefault ( ) const [inline, virtual]

IsBlocksDefault - Does this tool chain enable -fblocks by default.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 130 of file ToolChain.h.

virtual bool clang::driver::ToolChain::IsIntegratedAssemblerDefault ( ) const [inline, virtual]

IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.

Reimplemented in clang::driver::toolchains::Windows, clang::driver::toolchains::Generic_ELF, and clang::driver::toolchains::Darwin.

Definition at line 134 of file ToolChain.h.

Referenced by SelectToolForJob(), ShouldDisableCFI(), and ShouldDisableDwarfDirectory().

virtual bool clang::driver::ToolChain::IsObjCDefaultSynthPropertiesDefault ( ) const [inline, virtual]

IsObjCDefaultSynthPropertiesDefault - Does this tool chain enable -fobjc-default-synthesize-properties by default.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 142 of file ToolChain.h.

virtual bool clang::driver::ToolChain::IsObjCLegacyDispatchDefault ( ) const [inline, virtual]

IsObjCLegacyDispatchDefault - Does this tool chain set -fobjc-legacy-dispatch by default (this is only used with the non-fragile ABI).

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 151 of file ToolChain.h.

virtual bool clang::driver::ToolChain::IsObjCNonFragileABIDefault ( ) const [inline, virtual]

IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 146 of file ToolChain.h.

virtual bool clang::driver::ToolChain::IsStrictAliasingDefault ( ) const [inline, virtual]

IsStrictAliasingDefault - Does this tool chain use -fstrict-aliasing by default.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 138 of file ToolChain.h.

Referenced by clang::driver::toolchains::Darwin::IsStrictAliasingDefault().

virtual bool clang::driver::ToolChain::IsUnwindTablesDefault ( ) const [pure virtual]
types::ID ToolChain::LookupTypeForExtension ( const char *  Ext) const [virtual]

LookupTypeForExtension - Return the default language type to use for the given extension.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 43 of file ToolChain.cpp.

References clang::driver::types::lookupTypeForExtension().

Referenced by clang::driver::Driver::BuildInputs().

virtual Tool& clang::driver::ToolChain::SelectTool ( const Compilation C,
const JobAction JA,
const ActionList Inputs 
) const [pure virtual]
virtual bool clang::driver::ToolChain::SupportsObjCGC ( ) const [inline, virtual]

Does this tool chain support Objective-C garbage collection.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 185 of file ToolChain.h.

virtual bool clang::driver::ToolChain::SupportsProfiling ( ) const [inline, virtual]

SupportsProfiling - Does this tool chain support -pg.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 182 of file ToolChain.h.

virtual DerivedArgList* clang::driver::ToolChain::TranslateArgs ( const DerivedArgList Args,
const char *  BoundArch 
) const [inline, virtual]

TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may wish to perform, or 0 if no tool chain specific translations are needed.

Parameters:
BoundArch- The bound architecture name, or 0.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 104 of file ToolChain.h.

Referenced by clang::driver::Compilation::getArgsForToolChain().

virtual bool clang::driver::ToolChain::UseDwarfDebugFlags ( ) const [inline, virtual]

UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 189 of file ToolChain.h.

virtual bool clang::driver::ToolChain::UseObjCMixedDispatch ( ) const [inline, virtual]

UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be used?

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 155 of file ToolChain.h.

virtual bool clang::driver::ToolChain::UseSjLjExceptions ( ) const [inline, virtual]

UseSjLjExceptions - Does this tool chain use SjLj exceptions.

Reimplemented in clang::driver::toolchains::Darwin.

Definition at line 192 of file ToolChain.h.


The documentation for this class was generated from the following files: