aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index b61b8dcf2d..13d9820159 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1617,16 +1617,15 @@ 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.
- bool MathErrno = false;
+ // -fno-math-errno is default on Darwin. Other platforms, -fmath-errno is the
+ // default.
+ bool MathErrno = !getToolChain().getTriple().isOSDarwin();
if (Arg *A = Args.getLastArg(options::OPT_ffast_math,
options::OPT_fmath_errno,
- options::OPT_fno_math_errno)) {
- if (A->getOption().getID() == options::OPT_fmath_errno) {
- CmdArgs.push_back("-fmath-errno");
- MathErrno = true;
- }
- }
+ options::OPT_fno_math_errno))
+ MathErrno = A->getOption().getID() == options::OPT_fmath_errno;
+ if (MathErrno)
+ CmdArgs.push_back("-fmath-errno");
// There are several flags which require disabling very specific
// optimizations. Any of these being disabled forces us to turn off the