diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Driver/ToolChains.h')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/ToolChains.h | 612 |
1 files changed, 344 insertions, 268 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h index 50e745a..b5df866 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h @@ -13,11 +13,13 @@ #include "Tools.h" #include "clang/Basic/VersionTuple.h" #include "clang/Driver/Action.h" +#include "clang/Driver/Multilib.h" #include "clang/Driver/ToolChain.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/Optional.h" #include "llvm/Support/Compiler.h" -#include <vector> #include <set> +#include <vector> namespace clang { namespace driver { @@ -67,7 +69,6 @@ protected: bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); } }; - /// \brief This is a class to find a viable GCC installation for Clang to /// use. /// @@ -76,14 +77,17 @@ protected: /// Driver, and has logic for fuzzing that where appropriate. class GCCInstallationDetector { bool IsValid; - const Driver &D; llvm::Triple GCCTriple; // FIXME: These might be better as path objects. std::string GCCInstallPath; - std::string GCCBiarchSuffix; std::string GCCParentLibPath; - std::string GCCMIPSABIDirSuffix; + + /// The primary multilib appropriate for the given flags. + Multilib SelectedMultilib; + /// On Biarch systems, this corresponds to the default multilib when + /// targeting the non-default multilib. Otherwise, it is empty. + llvm::Optional<Multilib> BiarchSibling; GCCVersion Version; @@ -91,9 +95,13 @@ protected: // order to print out detailed information in verbose mode. std::set<std::string> CandidateGCCInstallPaths; + /// The set of multilibs that the detected installation supports. + MultilibSet Multilibs; + public: - GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {} - void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args); + GCCInstallationDetector() : IsValid(false) {} + void init(const Driver &D, const llvm::Triple &TargetTriple, + const llvm::opt::ArgList &Args); /// \brief Check whether we detected a valid GCC install. bool isValid() const { return IsValid; } @@ -104,26 +112,18 @@ protected: /// \brief Get the detected GCC installation path. StringRef getInstallPath() const { return GCCInstallPath; } - /// \brief Get the detected GCC installation path suffix for the bi-arch - /// target variant. - StringRef getBiarchSuffix() const { return GCCBiarchSuffix; } - /// \brief Get the detected GCC parent lib path. StringRef getParentLibPath() const { return GCCParentLibPath; } - /// \brief Get the detected GCC MIPS ABI directory suffix. - /// - /// This is used as a suffix both to the install directory of GCC and as - /// a suffix to its parent lib path in order to select a MIPS ABI-specific - /// subdirectory. - /// - /// This will always be empty for any non-MIPS target. - /// - // FIXME: This probably shouldn't exist at all, and should be factored - // into the multiarch and/or biarch support. Please don't add more uses of - // this interface, it is meant as a legacy crutch for the MIPS driver - // logic. - StringRef getMIPSABIDirSuffix() const { return GCCMIPSABIDirSuffix; } + /// \brief Get the detected Multilib + const Multilib &getMultilib() const { return SelectedMultilib; } + + /// \brief Get the whole MultilibSet + const MultilibSet &getMultilibs() const { return Multilibs; } + + /// Get the biarch sibling multilib (if it exists). + /// \return true iff such a sibling exists + bool getBiarchSibling(Multilib &M) const; /// \brief Get the detected GCC version string. const GCCVersion &getVersion() const { return Version; } @@ -140,15 +140,11 @@ protected: SmallVectorImpl<StringRef> &BiarchLibDirs, SmallVectorImpl<StringRef> &BiarchTripleAliases); - void ScanLibDirForGCCTriple(llvm::Triple::ArchType TargetArch, + void ScanLibDirForGCCTriple(const llvm::Triple &TargetArch, const llvm::opt::ArgList &Args, const std::string &LibDir, StringRef CandidateTriple, bool NeedsBiarchSuffix = false); - - void findMIPSABIDirSuffix(std::string &Suffix, - llvm::Triple::ArchType TargetArch, StringRef Path, - const llvm::opt::ArgList &Args); }; GCCInstallationDetector GCCInstallation; @@ -158,19 +154,18 @@ public: const llvm::opt::ArgList &Args); ~Generic_GCC(); - virtual void printVerboseInfo(raw_ostream &OS) const; + void printVerboseInfo(raw_ostream &OS) const override; - virtual bool IsUnwindTablesDefault() const; - virtual bool isPICDefault() const; - virtual bool isPIEDefault() const; - virtual bool isPICDefaultForced() const; - virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; + bool IsUnwindTablesDefault() const override; + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; + bool IsIntegratedAssemblerDefault() const override; protected: - virtual Tool *getTool(Action::ActionClass AC) const; - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *getTool(Action::ActionClass AC) const override; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; /// \name ToolChain Implementation Helper Functions /// @{ @@ -184,27 +179,138 @@ protected: /// @} private: - mutable OwningPtr<tools::gcc::Preprocess> Preprocess; - mutable OwningPtr<tools::gcc::Precompile> Precompile; - mutable OwningPtr<tools::gcc::Compile> Compile; + mutable std::unique_ptr<tools::gcc::Preprocess> Preprocess; + mutable std::unique_ptr<tools::gcc::Compile> Compile; +}; + +class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain { +protected: + Tool *buildAssembler() const override; + Tool *buildLinker() const override; + Tool *getTool(Action::ActionClass AC) const override; +private: + mutable std::unique_ptr<tools::darwin::Lipo> Lipo; + mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil; + mutable std::unique_ptr<tools::darwin::VerifyDebug> VerifyDebug; + +public: + MachO(const Driver &D, const llvm::Triple &Triple, + const llvm::opt::ArgList &Args); + ~MachO(); + + /// @name MachO specific toolchain API + /// { + + /// Get the "MachO" arch name for a particular compiler invocation. For + /// example, Apple treats different ARM variations as distinct architectures. + StringRef getMachOArchName(const llvm::opt::ArgList &Args) const; + + + /// Add the linker arguments to link the ARC runtime library. + virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const {} + + /// Add the linker arguments to link the compiler runtime library. + virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const; + + virtual void + addStartObjectFileArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const {} + + virtual void addMinVersionArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const {} + + /// On some iOS platforms, kernel and kernel modules were built statically. Is + /// this such a target? + virtual bool isKernelStatic() const { + return false; + } + + /// Is the target either iOS or an iOS simulator? + bool isTargetIOSBased() const { + return false; + } + + void AddLinkRuntimeLib(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs, + StringRef DarwinStaticLib, + bool AlwaysLink = false, + bool IsEmbedded = false) const; + + /// } + /// @name ToolChain Implementation + /// { + + std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, + types::ID InputType) const override; + + types::ID LookupTypeForExtension(const char *Ext) const override; + + bool HasNativeLLVMSupport() const override; + + llvm::opt::DerivedArgList * + TranslateArgs(const llvm::opt::DerivedArgList &Args, + const char *BoundArch) const override; + + bool IsBlocksDefault() const override { + // Always allow blocks on Apple; users interested in versioning are + // expected to use /usr/include/Blocks.h. + return true; + } + bool IsIntegratedAssemblerDefault() const override { + // Default integrated assembler to on for Apple's MachO targets. + return true; + } + + bool IsMathErrnoDefault() const override { + return false; + } + + bool IsEncodeExtendedBlockSignatureDefault() const override { + return true; + } + + bool IsObjCNonFragileABIDefault() const override { + // Non-fragile ABI is default for everything but i386. + return getTriple().getArch() != llvm::Triple::x86; + } + + bool UseObjCMixedDispatch() const override { + return true; + } + + bool IsUnwindTablesDefault() const override; + + RuntimeLibType GetDefaultRuntimeLibType() const override { + return ToolChain::RLT_CompilerRT; + } + + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; + + bool SupportsProfiling() const override; + + bool SupportsObjCGC() const override { + return false; + } + + bool UseDwarfDebugFlags() const override; + + bool UseSjLjExceptions() const override { + return false; + } + + /// } }; /// Darwin - The base Darwin tool chain. -class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain { +class LLVM_LIBRARY_VISIBILITY Darwin : public MachO { public: /// The host version. unsigned DarwinVersion[3]; -protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; - virtual Tool *getTool(Action::ActionClass AC) const; - -private: - mutable OwningPtr<tools::darwin::Lipo> Lipo; - mutable OwningPtr<tools::darwin::Dsymutil> Dsymutil; - mutable OwningPtr<tools::darwin::VerifyDebug> VerifyDebug; - /// Whether the information on the target has been initialized. // // FIXME: This should be eliminated. What we want to do is make this part of @@ -212,11 +318,13 @@ private: // the argument translation business. mutable bool TargetInitialized; - /// Whether we are targeting iPhoneOS target. - mutable bool TargetIsIPhoneOS; + enum DarwinPlatformKind { + MacOS, + IPhoneOS, + IPhoneOSSimulator + }; - /// Whether we are targeting the iPhoneOS simulator target. - mutable bool TargetIsIPhoneOSSimulator; + mutable DarwinPlatformKind TargetPlatform; /// The OS version we are targeting. mutable VersionTuple TargetVersion; @@ -239,43 +347,62 @@ public: ~Darwin(); std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, - types::ID InputType) const; + types::ID InputType) const override; + + /// @name Apple Specific Toolchain Implementation + /// { + + void + addMinVersionArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; + + void + addStartObjectFileArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; - /// @name Darwin Specific Toolchain API + bool isKernelStatic() const override { + return !isTargetIPhoneOS() || isIPhoneOSVersionLT(6, 0) || + getTriple().getArch() == llvm::Triple::arm64; + } + +protected: + /// } + /// @name Darwin specific Toolchain functions /// { // FIXME: Eliminate these ...Target functions and derive separate tool chains // for these targets and put version in constructor. - void setTarget(bool IsIPhoneOS, unsigned Major, unsigned Minor, - unsigned Micro, bool IsIOSSim) const { - assert((!IsIOSSim || IsIPhoneOS) && "Unexpected deployment target!"); - + void setTarget(DarwinPlatformKind Platform, unsigned Major, unsigned Minor, + unsigned Micro) const { // FIXME: For now, allow reinitialization as long as values don't // change. This will go away when we move away from argument translation. - if (TargetInitialized && TargetIsIPhoneOS == IsIPhoneOS && - TargetIsIPhoneOSSimulator == IsIOSSim && + if (TargetInitialized && TargetPlatform == Platform && TargetVersion == VersionTuple(Major, Minor, Micro)) return; assert(!TargetInitialized && "Target already initialized!"); TargetInitialized = true; - TargetIsIPhoneOS = IsIPhoneOS; - TargetIsIPhoneOSSimulator = IsIOSSim; + TargetPlatform = Platform; TargetVersion = VersionTuple(Major, Minor, Micro); } bool isTargetIPhoneOS() const { assert(TargetInitialized && "Target not initialized!"); - return TargetIsIPhoneOS; + return TargetPlatform == IPhoneOS; } bool isTargetIOSSimulator() const { assert(TargetInitialized && "Target not initialized!"); - return TargetIsIPhoneOSSimulator; + return TargetPlatform == IPhoneOSSimulator; + } + + bool isTargetIOSBased() const { + assert(TargetInitialized && "Target not initialized!"); + return isTargetIPhoneOS() || isTargetIOSSimulator(); } bool isTargetMacOS() const { - return !isTargetIOSSimulator() && !isTargetIPhoneOS(); + return TargetPlatform == MacOS; } bool isTargetInitialized() const { return TargetInitialized; } @@ -285,101 +412,58 @@ public: return TargetVersion; } - /// getDarwinArchName - Get the "Darwin" arch name for a particular compiler - /// invocation. For example, Darwin treats different ARM variations as - /// distinct architectures. - StringRef getDarwinArchName(const llvm::opt::ArgList &Args) const; - bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const { - assert(isTargetIPhoneOS() && "Unexpected call for OS X target!"); + assert(isTargetIOSBased() && "Unexpected call for non iOS target!"); return TargetVersion < VersionTuple(V0, V1, V2); } bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const { - assert(!isTargetIPhoneOS() && "Unexpected call for iPhoneOS target!"); + assert(isTargetMacOS() && "Unexpected call for non OS X target!"); return TargetVersion < VersionTuple(V0, V1, V2); } - /// AddLinkARCArgs - Add the linker arguments to link the ARC runtime library. - virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const = 0; - - /// AddLinkRuntimeLibArgs - Add the linker arguments to link the compiler - /// runtime library. - virtual void - AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const = 0; - +public: /// } /// @name ToolChain Implementation /// { - virtual types::ID LookupTypeForExtension(const char *Ext) const; + // Darwin tools support multiple architecture (e.g., i386 and x86_64) and + // most development is done against SDKs, so compiling for a different + // architecture should not get any special treatment. + bool isCrossCompiling() const override { return false; } - virtual bool HasNativeLLVMSupport() const; - - virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const; - virtual bool hasBlocksRuntime() const; - - virtual llvm::opt::DerivedArgList * + llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, - const char *BoundArch) const; - - virtual bool IsBlocksDefault() const { - // Always allow blocks on Darwin; users interested in versioning are - // expected to use /usr/include/Blocks.h. - return true; - } - virtual bool IsIntegratedAssemblerDefault() const { - // Default integrated assembler to on for Darwin. - return true; - } + const char *BoundArch) const override; - virtual bool IsMathErrnoDefault() const { - return false; - } + ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override; + bool hasBlocksRuntime() const override; - virtual bool IsEncodeExtendedBlockSignatureDefault() const { - return true; - } - - virtual bool IsObjCNonFragileABIDefault() const { - // Non-fragile ABI is default for everything but i386. - return getTriple().getArch() != llvm::Triple::x86; - } - - virtual bool UseObjCMixedDispatch() const { + bool UseObjCMixedDispatch() const override { // This is only used with the non-fragile ABI and non-legacy dispatch. // Mixed dispatch is used everywhere except OS X before 10.6. - return !(!isTargetIPhoneOS() && isMacosxVersionLT(10, 6)); + return !(isTargetMacOS() && isMacosxVersionLT(10, 6)); } - virtual bool IsUnwindTablesDefault() const; - virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { + + unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override { // Stack protectors default to on for user code on 10.5, // and for everything in 10.6 and beyond - return isTargetIPhoneOS() || - (!isMacosxVersionLT(10, 6) || - (!isMacosxVersionLT(10, 5) && !KernelOrKext)); + if (isTargetIOSBased()) + return 1; + else if (isTargetMacOS() && !isMacosxVersionLT(10, 6)) + return 1; + else if (isTargetMacOS() && !isMacosxVersionLT(10, 5) && !KernelOrKext) + return 1; + + return 0; } - virtual RuntimeLibType GetDefaultRuntimeLibType() const { - return ToolChain::RLT_CompilerRT; - } - virtual bool isPICDefault() const; - virtual bool isPIEDefault() const; - virtual bool isPICDefaultForced() const; - - virtual bool SupportsProfiling() const; - virtual bool SupportsObjCGC() const; + bool SupportsObjCGC() const override; - virtual void CheckObjCARC() const; + void CheckObjCARC() const override; - virtual bool UseDwarfDebugFlags() const; - - virtual bool UseSjLjExceptions() const; - - /// } + bool UseSjLjExceptions() const override; }; /// DarwinClang - The Darwin toolchain used by Clang. @@ -388,38 +472,27 @@ public: DarwinClang(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - /// @name Darwin ToolChain Implementation + /// @name Apple ToolChain Implementation /// { - virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; - void AddLinkRuntimeLib(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs, - const char *DarwinStaticLib, - bool AlwaysLink = false) const; - - virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; + void + AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; - virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; + void + AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; - virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; - /// } -}; + void + AddCCKextLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; -/// Darwin_Generic_GCC - Generic Darwin tool chain using gcc. -class LLVM_LIBRARY_VISIBILITY Darwin_Generic_GCC : public Generic_GCC { -public: - Darwin_Generic_GCC(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args) - : Generic_GCC(D, Triple, Args) {} + virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const; - std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, - types::ID InputType) const; - - virtual bool isPICDefault() const { return false; } + void + AddLinkARCArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; + /// } }; class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC { @@ -429,12 +502,8 @@ public: const llvm::opt::ArgList &Args) : Generic_GCC(D, Triple, Args) {} - virtual bool IsIntegratedAssemblerDefault() const { - // Default integrated assembler to on for x86. - return (getTriple().getArch() == llvm::Triple::aarch64 || - getTriple().getArch() == llvm::Triple::x86 || - getTriple().getArch() == llvm::Triple::x86_64); - } + void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; }; class LLVM_LIBRARY_VISIBILITY AuroraUX : public Generic_GCC { @@ -443,8 +512,8 @@ public: const llvm::opt::ArgList &Args); protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC { @@ -452,10 +521,10 @@ public: Solaris(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsIntegratedAssemblerDefault() const { return true; } + bool IsIntegratedAssemblerDefault() const override { return true; } protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; @@ -465,17 +534,25 @@ public: OpenBSD(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsMathErrnoDefault() const { return false; } - virtual bool IsObjCNonFragileABIDefault() const { return true; } - virtual bool isPIEDefault() const { return true; } + bool IsMathErrnoDefault() const override { return false; } + bool IsObjCNonFragileABIDefault() const override { return true; } + bool isPIEDefault() const override { return true; } + + unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override { + return 2; + } - virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { - return 1; + virtual bool IsIntegratedAssemblerDefault() const override { + if (getTriple().getArch() == llvm::Triple::ppc || + getTriple().getArch() == llvm::Triple::sparc || + getTriple().getArch() == llvm::Triple::sparcv9) + return true; + return Generic_ELF::IsIntegratedAssemblerDefault(); } protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY Bitrig : public Generic_ELF { @@ -483,48 +560,49 @@ public: Bitrig(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsMathErrnoDefault() const { return false; } - virtual bool IsObjCNonFragileABIDefault() const { return true; } - virtual bool IsObjCLegacyDispatchDefault() const { return false; } + bool IsMathErrnoDefault() const override { return false; } + bool IsObjCNonFragileABIDefault() const override { return true; } - virtual void + CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; - virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { + llvm::opt::ArgStringList &CC1Args) const override; + void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; + unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override { return 1; } protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { public: FreeBSD(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool HasNativeLLVMSupport() const; + bool HasNativeLLVMSupport() const override; - virtual bool IsMathErrnoDefault() const { return false; } - virtual bool IsObjCNonFragileABIDefault() const { return true; } + bool IsMathErrnoDefault() const override { return false; } + bool IsObjCNonFragileABIDefault() const override { return true; } - virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; - virtual void + CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual bool IsIntegratedAssemblerDefault() const { + llvm::opt::ArgStringList &CC1Args) const override; + bool IsIntegratedAssemblerDefault() const override { if (getTriple().getArch() == llvm::Triple::ppc || getTriple().getArch() == llvm::Triple::ppc64) return true; return Generic_ELF::IsIntegratedAssemblerDefault(); } - virtual bool UseSjLjExceptions() const; + bool UseSjLjExceptions() const override; + bool isPIEDefault() const override; protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { @@ -532,26 +610,26 @@ public: NetBSD(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsMathErrnoDefault() const { return false; } - virtual bool IsObjCNonFragileABIDefault() const { return true; } + bool IsMathErrnoDefault() const override { return false; } + bool IsObjCNonFragileABIDefault() const override { return true; } - virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; + CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; - virtual void + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual bool IsUnwindTablesDefault() const { + llvm::opt::ArgStringList &CC1Args) const override; + bool IsUnwindTablesDefault() const override { return true; } - virtual bool IsIntegratedAssemblerDefault() const { + bool IsIntegratedAssemblerDefault() const override { if (getTriple().getArch() == llvm::Triple::ppc) return true; return Generic_ELF::IsIntegratedAssemblerDefault(); } protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF { @@ -560,8 +638,8 @@ public: const llvm::opt::ArgList &Args); protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF { @@ -569,11 +647,11 @@ public: DragonFly(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsMathErrnoDefault() const { return false; } + bool IsMathErrnoDefault() const override { return false; } protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; }; class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF { @@ -581,31 +659,29 @@ public: Linux(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool HasNativeLLVMSupport() const; + bool HasNativeLLVMSupport() const override; - virtual void + void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void + llvm::opt::ArgStringList &CC1Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual bool isPIEDefault() const; + llvm::opt::ArgStringList &CC1Args) const override; + bool isPIEDefault() const override; std::string Linker; std::vector<std::string> ExtraOpts; protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; private: static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, - Twine TargetArchDir, - Twine BiarchSuffix, - Twine MIPSABIDirSuffix, - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args); - static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, + StringRef GCCTriple, + StringRef GCCMultiarchTriple, + StringRef TargetMultiarchTriple, + Twine IncludeSuffix, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args); @@ -615,21 +691,21 @@ private: class LLVM_LIBRARY_VISIBILITY Hexagon_TC : public Linux { protected: GCCVersion GCCLibAndIncVersion; - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; public: Hexagon_TC(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); ~Hexagon_TC(); - virtual void + void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void + llvm::opt::ArgStringList &CC1Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const; + llvm::opt::ArgStringList &CC1Args) const override; + CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; } @@ -646,10 +722,10 @@ public: const llvm::opt::ArgList &Args); ~TCEToolChain(); - bool IsMathErrnoDefault() const; - bool isPICDefault() const; - bool isPIEDefault() const; - bool isPICDefaultForced() const; + bool IsMathErrnoDefault() const override; + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; }; class LLVM_LIBRARY_VISIBILITY Windows : public ToolChain { @@ -657,22 +733,22 @@ public: Windows(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); - virtual bool IsIntegratedAssemblerDefault() const; - virtual bool IsUnwindTablesDefault() const; - virtual bool isPICDefault() const; - virtual bool isPIEDefault() const; - virtual bool isPICDefaultForced() const; + bool IsIntegratedAssemblerDefault() const override; + bool IsUnwindTablesDefault() const override; + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; - virtual void + void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void + llvm::opt::ArgStringList &CC1Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; + llvm::opt::ArgStringList &CC1Args) const override; protected: - virtual Tool *buildLinker() const; - virtual Tool *buildAssembler() const; + Tool *buildLinker() const override; + Tool *buildAssembler() const override; }; @@ -681,22 +757,22 @@ public: XCore(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); protected: - virtual Tool *buildAssembler() const; - virtual Tool *buildLinker() const; + Tool *buildAssembler() const override; + Tool *buildLinker() const override; public: - virtual bool isPICDefault() const; - virtual bool isPIEDefault() const; - virtual bool isPICDefaultForced() const; - virtual bool SupportsProfiling() const; - virtual bool hasBlocksRuntime() const; - virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; - virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; + bool isPICDefault() const override; + bool isPIEDefault() const override; + bool isPICDefaultForced() const override; + bool SupportsProfiling() const override; + bool hasBlocksRuntime() const override; + void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; }; } // end namespace toolchains |