Driver: Fix forwarding of -fpascal-strings.

llvm-svn: 68570
This commit is contained in:
Daniel Dunbar 2009-04-07 23:51:44 +00:00
parent 10f7c3deb7
commit d4510f2223
2 changed files with 21 additions and 14 deletions

View File

@ -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.

View File

@ -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