diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-07 21:16:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-07 21:16:11 +0000 |
commit | 48d1ef782c8c88066b5febf60f8f456064d7d3f0 (patch) | |
tree | 208659df6d6ae4500c5441e888bf4cee813c0ea0 /lib/Driver/Tools.cpp | |
parent | 9af6668984f1594459a58c381d95272aa7ca7663 (diff) |
Driver: Manually translate a number of -f with no- variants options to
clang.
- We will eventually want some more driver infrastructre for this
probably.
- For now, the clang-cc interface stays relatively the same, but we
don't accept multiple instances anymore, or the [no-] variants
directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index e26bb9e85a..dd3a00ecb3 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -357,8 +357,34 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(A->getValue(Args)); } + // Forward -f options which we can pass directly. Args.AddAllArgs(CmdArgs, options::OPT_clang_f_Group); + // Forward -f options with positive and negative forms; we translate + // these by hand. + + // -fbuiltin is default, only pass non-default. + if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin)) + CmdArgs.push_back("-fbuiltin=0"); + + // -fblocks default varies depending on platform and language; + // -always pass if specified. + if (Arg *A = Args.getLastArg(options::OPT_fblocks, options::OPT_fno_blocks)) { + if (A->getOption().matches(options::OPT_fblocks)) + CmdArgs.push_back("-fblocks"); + else + CmdArgs.push_back("-fblocks=0"); + } + + // -fno-pascal-strings is default, only pass non-default. + if (Args.hasFlag(options::OPT_fpascal_strings, + options::OPT_fno_pascal_strings)) + CmdArgs.push_back("-fpascal-strings"); + + // -fcommon is default, only pass non-default. + if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common)) + CmdArgs.push_back("-fno-common"); + // If tool chain translates fpascal-strings, we want to back // translate here. // FIXME: This is gross; that translation should be pulled from the |