aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-07 23:51:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-07 23:51:44 +0000
commit82d00688525c876bf47bce414dedae9c343e67f5 (patch)
tree5f5ee364f2d5cac08debec937dc72947e8429f20
parent93a259500186fa7270f66cb460c5f5728e5680ae (diff)
Driver: Fix forwarding of -fpascal-strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68570 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/Tools.cpp25
-rw-r--r--test/Driver/clang_f_opts.c10
2 files changed, 21 insertions, 14 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index a3cea95c26..f44be0a7be 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -410,27 +410,24 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fblocks=0");
}
- // -fno-pascal-strings is default, only pass non-default.
+ // -fno-pascal-strings is default, only pass non-default. If the
+ // -tool chain happened to translate to -mpascal-strings, we want to
+ // -back translate here.
+ //
+ // FIXME: This is gross; that translation should be pulled from the
+ // tool chain.
if (Args.hasFlag(options::OPT_fpascal_strings,
- options::OPT_fno_pascal_strings))
+ options::OPT_fno_pascal_strings,
+ false) ||
+ Args.hasFlag(options::OPT_mpascal_strings,
+ options::OPT_mno_pascal_strings,
+ false))
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
- // tool chain.
- if (Arg *A = Args.getLastArg(options::OPT_mpascal_strings,
- options::OPT_mno_pascal_strings)) {
- if (A->getOption().matches(options::OPT_mpascal_strings))
- CmdArgs.push_back("-fpascal-strings");
- else
- CmdArgs.push_back("-fno-pascal-strings");
- }
-
Args.AddLastArg(CmdArgs, options::OPT_dM);
// Add -Wp, and -Xassembler if using the preprocessor.
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
new file mode 100644
index 0000000000..9dc8f63db8
--- /dev/null
+++ b/test/Driver/clang_f_opts.c
@@ -0,0 +1,10 @@
+// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t &&
+// RUN: grep -F '"-fblocks"' %t &&
+// RUN: grep -F '"--fmath-errno=1"' %t &&
+// RUN: grep -F '"-fpascal-strings"' %t &&
+// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings %s 2> %t &&
+// RUN: grep -F '"-fblocks=0"' %t &&
+// RUN: grep -F '"-fbuiltin=0"' %t &&
+// RUN: grep -F '"-fno-common"' %t &&
+// RUN: grep -F '"--fmath-errno=0"' %t &&
+// RUN: true