clang  3.9.0
Public Member Functions | Protected Member Functions | List of all members
clang::driver::toolchains::MSVCToolChain Class Reference

#include <ToolChains.h>

Inheritance diagram for clang::driver::toolchains::MSVCToolChain:
[legend]
Collaboration diagram for clang::driver::toolchains::MSVCToolChain:
[legend]

Public Member Functions

 MSVCToolChain (const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
 
llvm::opt::DerivedArgList * TranslateArgs (const llvm::opt::DerivedArgList &Args, const char *BoundArch) const override
 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. More...
 
bool IsIntegratedAssemblerDefault () const override
 IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default. More...
 
bool IsUnwindTablesDefault () const override
 IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default. More...
 
bool isPICDefault () const override
 Test whether this toolchain defaults to PIC. More...
 
bool isPIEDefault () const override
 Test whether this toolchain defaults to PIE. More...
 
bool isPICDefaultForced () const override
 Tests whether this toolchain forces its default for PIC, PIE or non-PIC. More...
 
void AddClangSystemIncludeArgs (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
 Add the clang cc1 arguments for system include paths. More...
 
void AddClangCXXStdlibIncludeArgs (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
 AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for the given C++ standard library type. More...
 
bool getWindowsSDKDir (std::string &path, int &major, std::string &windowsSDKIncludeVersion, std::string &windowsSDKLibVersion) const
 Get Windows SDK installation directory. More...
 
bool getWindowsSDKLibraryPath (std::string &path) const
 
bool useUniversalCRT (std::string &visualStudioDir) const
 Check if Universal CRT should be used if available. More...
 
bool getUniversalCRTSdkDir (std::string &path, std::string &ucrtVersion) const
 
bool getUniversalCRTLibraryPath (std::string &path) const
 
bool getVisualStudioInstallDir (std::string &path) const
 
bool getVisualStudioBinariesFolder (const char *clangProgramPath, std::string &path) const
 
VersionTuple getMSVCVersionFromExe () const override
 On Windows, returns the version of cl.exe. More...
 
std::string ComputeEffectiveClangTriple (const llvm::opt::ArgList &Args, types::ID InputType) const override
 ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into account the command line arguments. More...
 
SanitizerMask getSupportedSanitizers () const override
 Return sanitizers which are available in this toolchain. More...
 
- Public Member Functions inherited from clang::driver::ToolChain
virtual ~ToolChain ()
 
const DrivergetDriver () const
 
vfs::FileSystemgetVFS () const
 
const llvm::Triple & getTriple () const
 
llvm::Triple::ArchType getArch () const
 
StringRef getArchName () const
 
StringRef getPlatform () const
 
StringRef getOS () const
 
StringRef getDefaultUniversalArchName () const
 Provide the default architecture name (as expected by -arch) for this toolchain. More...
 
std::string getTripleString () const
 
path_listgetFilePaths ()
 
const path_listgetFilePaths () const
 
path_listgetProgramPaths ()
 
const path_listgetProgramPaths () const
 
const MultilibSetgetMultilibs () const
 
const SanitizerArgsgetSanitizerArgs () const
 
const llvm::opt::Arg * getRTTIArg () const
 
RTTIMode getRTTIMode () const
 
virtual ToolSelectTool (const JobAction &JA) const
 Choose a tool to use to handle the action JA. More...
 
std::string GetFilePath (const char *Name) const
 
std::string GetProgramPath (const char *Name) const
 
std::string GetLinkerPath () const
 Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name. More...
 
virtual void printVerboseInfo (raw_ostream &OS) const
 Dispatch to the specific toolchain for verbose printing. More...
 
virtual bool isCrossCompiling () const
 Returns true if the toolchain is targeting a non-native architecture. More...
 
virtual bool HasNativeLLVMSupport () const
 HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support. More...
 
virtual types::ID LookupTypeForExtension (const char *Ext) const
 LookupTypeForExtension - Return the default language type to use for the given extension. More...
 
virtual bool IsBlocksDefault () const
 IsBlocksDefault - Does this tool chain enable -fblocks by default. More...
 
virtual bool useIntegratedAs () const
 Check if the toolchain should use the integrated assembler. More...
 
virtual bool IsMathErrnoDefault () const
 IsMathErrnoDefault - Does this tool chain use -fmath-errno by default. More...
 
virtual bool IsEncodeExtendedBlockSignatureDefault () const
 IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature by default. More...
 
virtual bool IsObjCNonFragileABIDefault () const
 IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default. More...
 
virtual bool UseObjCMixedDispatch () const
 UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be used? More...
 
virtual unsigned GetDefaultStackProtectorLevel (bool KernelOrKext) const
 GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off, 1=on, 2=strong, 3=all). More...
 
virtual RuntimeLibType GetDefaultRuntimeLibType () const
 GetDefaultRuntimeLibType - Get the default runtime library variant to use. More...
 
virtual CXXStdlibType GetDefaultCXXStdlibType () const
 
virtual std::string getCompilerRT (const llvm::opt::ArgList &Args, StringRef Component, bool Shared=false) const
 
const char * getCompilerRTArgString (const llvm::opt::ArgList &Args, StringRef Component, bool Shared=false) const
 
virtual bool SupportsProfiling () const
 SupportsProfiling - Does this tool chain support -pg. More...
 
virtual bool SupportsObjCGC () const
 Does this tool chain support Objective-C garbage collection. More...
 
virtual void CheckObjCARC () const
 Complain if this tool chain doesn't support Objective-C ARC. More...
 
virtual bool UseDwarfDebugFlags () const
 UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information. More...
 
virtual unsigned GetDefaultDwarfVersion () const
 
virtual bool GetDefaultStandaloneDebug () const
 
virtual llvm::DebuggerKind getDefaultDebuggerTuning () const
 
virtual bool UseSjLjExceptions (const llvm::opt::ArgList &Args) const
 UseSjLjExceptions - Does this tool chain use SjLj exceptions. More...
 
virtual bool SupportsEmbeddedBitcode () const
 SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode. More...
 
virtual std::string getThreadModel () const
 getThreadModel() - Which thread model does this target use? More...
 
virtual bool isThreadModelSupported (const StringRef Model) const
 isThreadModelSupported() - Does this target support a thread model? More...
 
virtual std::string ComputeLLVMTriple (const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
 ComputeLLVMTriple - Return the LLVM target triple to use, after taking command line arguments into account. More...
 
virtual ObjCRuntime getDefaultObjCRuntime (bool isNonFragile) const
 getDefaultObjCRuntime - Return the default Objective-C runtime for this platform. More...
 
virtual bool hasBlocksRuntime () const
 hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the existence of a blocks runtime? More...
 
virtual void addClangTargetOptions (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
 Add options that need to be passed to cc1 for this target. More...
 
virtual void addClangWarningOptions (llvm::opt::ArgStringList &CC1Args) const
 Add warning options that need to be passed to cc1 for this target. More...
 
virtual RuntimeLibType GetRuntimeLibType (const llvm::opt::ArgList &Args) const
 
virtual CXXStdlibType GetCXXStdlibType (const llvm::opt::ArgList &Args) const
 
virtual void AddCXXStdlibLibArgs (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
 AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard library type. More...
 
void AddFilePathLibArgs (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
 AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option. More...
 
virtual void AddCCKextLibArgs (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
 AddCCKextLibArgs - Add the system specific linker arguments to use for kernel extensions (Darwin-specific). More...
 
virtual bool AddFastMathRuntimeIfAvailable (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
 AddFastMathRuntimeIfAvailable - If a runtime library exists that sets global flags for unsafe floating point math, add it and return true. More...
 
virtual void addProfileRTLibs (const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
 addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass a suitable profile runtime library to the linker. More...
 
virtual void AddCudaIncludeArgs (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
 Add arguments to use system-specific CUDA includes. More...
 
virtual void AddIAMCUIncludeArgs (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
 Add arguments to use MCU GCC toolchain includes. More...
 
virtual SanitizerMask getDefaultSanitizers () const
 Return sanitizers which are enabled by default. More...
 

Protected Member Functions

void AddSystemIncludeWithSubfolder (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const std::string &folder, const Twine &subfolder1, const Twine &subfolder2="", const Twine &subfolder3="") const
 
ToolbuildLinker () const override
 
ToolbuildAssembler () const override
 
- Protected Member Functions inherited from clang::driver::ToolChain
 ToolChain (const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args)
 
virtual ToolgetTool (Action::ActionClass AC) const
 

Additional Inherited Members

- Public Types inherited from clang::driver::ToolChain
enum  CXXStdlibType { CST_Libcxx, CST_Libstdcxx }
 
enum  RuntimeLibType { RLT_CompilerRT, RLT_Libgcc }
 
enum  RTTIMode { RM_EnabledExplicitly, RM_EnabledImplicitly, RM_DisabledExplicitly, RM_DisabledImplicitly }
 
typedef SmallVector
< std::string, 16 > 
path_list
 
- Static Public Member Functions inherited from clang::driver::ToolChain
static std::pair< std::string,
std::string > 
getTargetAndModeFromProgramName (StringRef ProgName)
 Return any implicit target and/or mode flag for an invocation of the compiler driver as ProgName. More...
 
static bool needsProfileRT (const llvm::opt::ArgList &Args)
 needsProfileRT - returns true if instrumentation profile is on. More...
 
- Static Protected Member Functions inherited from clang::driver::ToolChain
static void addSystemInclude (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
 Utility function to add a system include directory to CC1 arguments. More...
 
static void addExternCSystemInclude (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
 Utility function to add a system include directory with extern "C" semantics to CC1 arguments. More...
 
static void addExternCSystemIncludeIfExists (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
 
static void addSystemIncludes (const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, ArrayRef< StringRef > Paths)
 Utility function to add a list of system include directories to CC1. More...
 
- Protected Attributes inherited from clang::driver::ToolChain
MultilibSet Multilibs
 
const char * DefaultLinker = "ld"
 

Detailed Description

Definition at line 1027 of file ToolChains.h.

Constructor & Destructor Documentation

MSVCToolChain::MSVCToolChain ( const Driver D,
const llvm::Triple &  Triple,
const llvm::opt::ArgList &  Args 
)

Member Function Documentation

void MSVCToolChain::AddClangCXXStdlibIncludeArgs ( const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args 
) const
overridevirtual

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

Reimplemented from clang::driver::ToolChain.

Definition at line 661 of file MSVCToolChain.cpp.

void MSVCToolChain::AddClangSystemIncludeArgs ( const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args 
) const
overridevirtual

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 from clang::driver::ToolChain.

Definition at line 577 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::addSystemInclude(), clang::driver::ToolChain::addSystemIncludes(), AddSystemIncludeWithSubfolder(), clang::driver::ToolChain::getDriver(), getUniversalCRTSdkDir(), getVisualStudioInstallDir(), getWindowsSDKDir(), and useUniversalCRT().

void MSVCToolChain::AddSystemIncludeWithSubfolder ( const llvm::opt::ArgList &  DriverArgs,
llvm::opt::ArgStringList &  CC1Args,
const std::string &  folder,
const Twine &  subfolder1,
const Twine &  subfolder2 = "",
const Twine &  subfolder3 = "" 
) const
protected
Tool * MSVCToolChain::buildAssembler ( ) const
overrideprotectedvirtual
Tool * MSVCToolChain::buildLinker ( ) const
overrideprotectedvirtual

Reimplemented from clang::driver::ToolChain.

Definition at line 56 of file MSVCToolChain.cpp.

std::string MSVCToolChain::ComputeEffectiveClangTriple ( const llvm::opt::ArgList &  Args,
types::ID  InputType 
) const
overridevirtual

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 from clang::driver::ToolChain.

Definition at line 667 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::ComputeEffectiveClangTriple(), clang::VersionTuple::empty(), clang::VersionTuple::getAsString(), clang::VersionTuple::getMajor(), clang::VersionTuple::getMinor(), clang::driver::tools::visualstudio::getMSVCVersion(), and clang::VersionTuple::getSubminor().

VersionTuple MSVCToolChain::getMSVCVersionFromExe ( ) const
overridevirtual

On Windows, returns the version of cl.exe.

On other platforms, returns an empty VersionTuple.

Reimplemented from clang::driver::ToolChain.

Definition at line 473 of file MSVCToolChain.cpp.

References getVisualStudioBinariesFolder().

SanitizerMask MSVCToolChain::getSupportedSanitizers ( ) const
overridevirtual

Return sanitizers which are available in this toolchain.

Reimplemented from clang::driver::ToolChain.

Definition at line 692 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::getSupportedSanitizers().

bool MSVCToolChain::getUniversalCRTLibraryPath ( std::string &  path) const
bool MSVCToolChain::getUniversalCRTSdkDir ( std::string &  path,
std::string &  ucrtVersion 
) const
bool MSVCToolChain::getVisualStudioBinariesFolder ( const char *  clangProgramPath,
std::string &  path 
) const
bool MSVCToolChain::getVisualStudioInstallDir ( std::string &  path) const
bool MSVCToolChain::getWindowsSDKDir ( std::string &  path,
int &  major,
std::string &  windowsSDKIncludeVersion,
std::string &  windowsSDKLibVersion 
) const

Get Windows SDK installation directory.

Definition at line 267 of file MSVCToolChain.cpp.

References getSystemRegistryString(), and getWindows10SDKVersion().

Referenced by AddClangSystemIncludeArgs(), and getWindowsSDKLibraryPath().

bool MSVCToolChain::getWindowsSDKLibraryPath ( std::string &  path) const
bool MSVCToolChain::IsIntegratedAssemblerDefault ( ) const
overridevirtual

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

Reimplemented from clang::driver::ToolChain.

Definition at line 67 of file MSVCToolChain.cpp.

bool MSVCToolChain::isPICDefault ( ) const
overridevirtual

Test whether this toolchain defaults to PIC.

Implements clang::driver::ToolChain.

Definition at line 83 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::getArch().

bool MSVCToolChain::isPICDefaultForced ( ) const
overridevirtual

Tests whether this toolchain forces its default for PIC, PIE or non-PIC.

If this returns true, any PIC related flags should be ignored and instead the results of isPICDefault() and isPIEDefault() are used exclusively.

Implements clang::driver::ToolChain.

Definition at line 91 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::getArch().

bool MSVCToolChain::isPIEDefault ( ) const
overridevirtual

Test whether this toolchain defaults to PIE.

Implements clang::driver::ToolChain.

Definition at line 87 of file MSVCToolChain.cpp.

bool MSVCToolChain::IsUnwindTablesDefault ( ) const
overridevirtual

IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.

Reimplemented from clang::driver::ToolChain.

Definition at line 71 of file MSVCToolChain.cpp.

References clang::driver::ToolChain::getArch(), and clang::driver::ToolChain::getTriple().

llvm::opt::DerivedArgList * MSVCToolChain::TranslateArgs ( const llvm::opt::DerivedArgList &  Args,
const char *  BoundArch 
) const
overridevirtual

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 from clang::driver::ToolChain.

Definition at line 808 of file MSVCToolChain.cpp.

References E, clang::driver::ToolChain::getArch(), clang::driver::ToolChain::getDriver(), clang::driver::Driver::getOpts(), I, TranslateDArg(), and TranslateOptArg().

bool clang::driver::toolchains::MSVCToolChain::useUniversalCRT ( std::string &  visualStudioDir) const

Check if Universal CRT should be used if available.

Definition at line 351 of file MSVCToolChain.cpp.

Referenced by AddClangSystemIncludeArgs().


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