diff options
Diffstat (limited to 'lib/Driver')
-rw-r--r-- | lib/Driver/ToolChains.h | 11 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index eaa6be1b0d..a76a773a64 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -333,7 +333,11 @@ public: return ToolChain::IsStrictAliasingDefault(); #endif } - + + virtual bool IsMathErrnoDefault() const { + return false; + } + virtual bool IsObjCDefaultSynthPropertiesDefault() const { return true; } @@ -459,6 +463,7 @@ class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF { public: OpenBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args); + virtual bool IsMathErrnoDefault() const { return false; } virtual bool IsObjCNonFragileABIDefault() const { return true; } virtual bool IsObjCLegacyDispatchDefault() const { llvm::Triple::ArchType Arch = getTriple().getArch(); @@ -477,6 +482,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { public: FreeBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args); + virtual bool IsMathErrnoDefault() const { return false; } virtual bool IsObjCNonFragileABIDefault() const { return true; } virtual bool IsObjCLegacyDispatchDefault() const { llvm::Triple::ArchType Arch = getTriple().getArch(); @@ -495,6 +501,7 @@ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { public: NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args); + virtual bool IsMathErrnoDefault() const { return false; } virtual bool IsObjCNonFragileABIDefault() const { return true; } virtual bool IsObjCLegacyDispatchDefault() const { llvm::Triple::ArchType Arch = getTriple().getArch(); @@ -521,6 +528,8 @@ class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF { public: DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args); + virtual bool IsMathErrnoDefault() const { return false; } + virtual Tool &SelectTool(const Compilation &C, const JobAction &JA, const ActionList &Inputs) const; }; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2cf0c6747c..6b3effb4d0 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1617,9 +1617,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, A->getOption().getID() != options::OPT_fhonor_nans) CmdArgs.push_back("-menable-no-nans"); - // -fno-math-errno is default on Darwin. Other platforms, -fmath-errno is the - // default. - bool MathErrno = !getToolChain().getTriple().isOSDarwin(); + // -fmath-errno is the default on some platforms, e.g. BSD-derived OSes. + bool MathErrno = getToolChain().IsMathErrnoDefault(); if (Arg *A = Args.getLastArg(options::OPT_ffast_math, options::OPT_fmath_errno, options::OPT_fno_math_errno)) |