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.

llvm-svn: 68550
This commit is contained in:
Daniel Dunbar 2009-04-07 21:16:11 +00:00
parent 30bf11e181
commit d18049ab1d
5 changed files with 40 additions and 18 deletions

View File

@ -424,11 +424,11 @@ OPTION("-fasm-blocks", fasm_blocks, Flag, clang_ignored_f_Group, INVALID, "", 0,
OPTION("-fastcp", fastcp, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fastf", fastf, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fast", fast, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fblocks", fblocks, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fblocks", fblocks, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fbootclasspath=", fbootclasspath_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fbuiltin", fbuiltin, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fbuiltin", fbuiltin, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fclasspath=", fclasspath_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fcommon", fcommon, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fcommon", fcommon, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fcompile-resource=", fcompile_resource_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fconstant-cfstrings", fconstant_cfstrings, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fcreate-profile", fcreate_profile, Flag, f_Group, INVALID, "", 0, 0, 0)
@ -459,10 +459,10 @@ OPTION("-fmudflapth", fmudflapth, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fmudflap", fmudflap, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fnested-functions", fnested_functions, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fnext-runtime", fnext_runtime, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-blocks", fno_blocks, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-builtin", fno_builtin, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-blocks", fno_blocks, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-builtin", fno_builtin, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-caret-diagnostics", fno_caret_diagnostics, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-common", fno_common, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-common", fno_common, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-constant-cfstrings", fno_constant_cfstrings, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-eliminate-unused-debug-symbols", fno_eliminate_unused_debug_symbols, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fno-inline-functions", fno_inline_functions, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
@ -488,7 +488,7 @@ OPTION("-fopenmp", fopenmp, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-force_cpusubtype_ALL", force__cpusubtype__ALL, Flag, INVALID, INVALID, "", 0, 0, 0)
OPTION("-force_flat_namespace", force__flat__namespace, Flag, INVALID, INVALID, "", 0, 0, 0)
OPTION("-foutput-class-dir=", foutput_class_dir_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fpascal-strings", fpascal_strings, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-fpascal-strings", fpascal_strings, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fpch-preprocess", fpch_preprocess, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fpic", fpic, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fpie", fpie, Flag, f_Group, INVALID, "", 0, 0, 0)

View File

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

View File

@ -1,4 +1,4 @@
// RUN: clang-cc %s -verify -pedantic -fsyntax-only -fno-blocks
// RUN: clang-cc %s -verify -pedantic -fsyntax-only -fblocks=0
// PR1966
_Complex double test1() {

View File

@ -1,4 +1,4 @@
// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s
// RUN: clang-cc -fsyntax-only -verify -fmath-errno=0 %s
int foo(int X, int Y);

View File

@ -323,15 +323,13 @@ Freestanding("ffreestanding",
"freestanding environment"));
static llvm::cl::opt<bool>
AllowBuiltins("fbuiltin",
llvm::cl::desc("Disable implicit builtin knowledge of functions"),
llvm::cl::init(true), llvm::cl::AllowInverse);
AllowBuiltins("fbuiltin", llvm::cl::init(true),
llvm::cl::desc("Disable implicit builtin knowledge of functions"));
static llvm::cl::opt<bool>
MathErrno("fmath-errno",
llvm::cl::desc("Require math functions to respect errno"),
llvm::cl::init(true), llvm::cl::AllowInverse);
MathErrno("fmath-errno", llvm::cl::init(true),
llvm::cl::desc("Require math functions to respect errno"));
//===----------------------------------------------------------------------===//
// Language Options
@ -546,9 +544,7 @@ NoLaxVectorConversions("fno-lax-vector-conversions",
"elements or different element types"));
static llvm::cl::opt<bool>
EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"),
llvm::cl::ValueDisallowed, llvm::cl::AllowInverse,
llvm::cl::ZeroOrMore);
EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"));
static llvm::cl::opt<bool>
EnableHeinousExtensions("fheinous-gnu-extensions",