From 34d7a99062222ce2eb60d66338f625009e4335fe Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 27 Apr 2010 15:34:57 +0000 Subject: [PATCH] Add Driver support for -fno-constant-cfstrings. llvm-svn: 102431 --- clang/include/clang/Driver/Options.td | 2 +- clang/lib/Driver/Tools.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1487121208be..844d317846f9 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -248,7 +248,7 @@ def fclasspath_EQ : Joined<"-fclasspath=">, Group; def fcolor_diagnostics : Flag<"-fcolor-diagnostics">, Group; def fcommon : Flag<"-fcommon">, Group; def fcompile_resource_EQ : Joined<"-fcompile-resource=">, Group; -def fconstant_cfstrings : Flag<"-fconstant-cfstrings">, Group; +def fconstant_cfstrings : Flag<"-fconstant-cfstrings">, Group; def fconstant_string_class_EQ : Joined<"-fconstant-string-class=">, Group; def fcreate_profile : Flag<"-fcreate-profile">, Group; def fdebug_pass_arguments : Flag<"-fdebug-pass-arguments">, Group; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 8ad04aa508e6..db5f92d8ec6b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1248,6 +1248,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_assume_sane_operator_new)) CmdArgs.push_back("-fno-assume-sane-operator-new"); + // -fconstant-cfstrings is default, and may be subject to argument translation + // on Darwin. + if (!Args.hasFlag(options::OPT_fconstant_cfstrings, + options::OPT_fno_constant_cfstrings) || + !Args.hasFlag(options::OPT_mconstant_cfstrings, + options::OPT_mno_constant_cfstrings)) + CmdArgs.push_back("-fno-constant-cfstrings"); + // -fshort-wchar default varies depending on platform; only // pass if specified. if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar)) {