forked from OSchip/llvm-project
Driver: Add "d" flag to Options.def for options which are completely
handled by driver. - This is not very precise, we use it to drive the "forward-to-gcc" predicate, when trying to talk to a generic gcc tool. - Slightly better than what ccc was doing, and should be good enough. Platforms which want a robust driver should implement a proper tool chain. llvm-svn: 67181
This commit is contained in:
parent
64a6a092b1
commit
4b6058e33a
|
@ -82,6 +82,9 @@ namespace driver {
|
|||
/// Always render this option joined with its value.
|
||||
bool ForceJoinedRender : 1;
|
||||
|
||||
/// Forward to generic GCC tools.
|
||||
bool ForwardToGCC : 1;
|
||||
|
||||
protected:
|
||||
Option(OptionClass Kind, options::ID ID, const char *Name,
|
||||
const OptionGroup *Group, const Option *Alias);
|
||||
|
@ -100,14 +103,17 @@ namespace driver {
|
|||
bool isLinkerInput() const { return LinkerInput; }
|
||||
void setLinkerInput(bool Value) { LinkerInput = Value; }
|
||||
|
||||
bool isNoOptAsInput() const { return NoOptAsInput; }
|
||||
bool hasNoOptAsInput() const { return NoOptAsInput; }
|
||||
void setNoOptAsInput(bool Value) { NoOptAsInput = Value; }
|
||||
|
||||
bool isForceSeparateRender() const { return ForceSeparateRender; }
|
||||
|
||||
bool hasForceSeparateRender() const { return ForceSeparateRender; }
|
||||
void setForceSeparateRender(bool Value) { ForceSeparateRender = Value; }
|
||||
|
||||
bool isForceJoinedRender() const { return ForceJoinedRender; }
|
||||
|
||||
bool hasForceJoinedRender() const { return ForceJoinedRender; }
|
||||
void setForceJoinedRender(bool Value) { ForceJoinedRender = Value; }
|
||||
|
||||
bool hasForwardToGCC() const { return ForwardToGCC; }
|
||||
void setForwardToGCC(bool Value) { ForwardToGCC = Value; }
|
||||
|
||||
/// getUnaliasedOption - Return the final option this option
|
||||
/// aliases (itself, if the option has no alias).
|
||||
|
|
|
@ -48,11 +48,14 @@
|
|||
// INVALID if the option is not an alias.
|
||||
|
||||
// The sixth value is a string containing option flags. Valid values:
|
||||
// l: The option is a linker input.
|
||||
// d: The option is a "driver" option, and should not be forwarded to
|
||||
// gcc.
|
||||
//
|
||||
// i: The option should not render the name when rendered as an
|
||||
// input.
|
||||
//
|
||||
// l: The option is a linker input.
|
||||
//
|
||||
// u: The option is unsupported, and the driver will reject command
|
||||
// lines that use it.
|
||||
//
|
||||
|
@ -175,7 +178,7 @@ OPTION("--param", _param, Separate, INVALID, INVALID, "", 0)
|
|||
OPTION("--pass-exit-codes", _pass_exit_codes, Flag, INVALID, pass_exit_codes, "", 0)
|
||||
OPTION("--pedantic-errors", _pedantic_errors, Flag, INVALID, pedantic_errors, "", 0)
|
||||
OPTION("--pedantic", _pedantic, Flag, INVALID, pedantic, "", 0)
|
||||
OPTION("--pipe", _pipe, Flag, INVALID, pipe, "", 0)
|
||||
OPTION("--pipe", _pipe, Flag, INVALID, pipe, "d", 0)
|
||||
OPTION("--prefix=", _prefix_EQ, Joined, INVALID, B, "S", 0)
|
||||
OPTION("--prefix", _prefix, Separate, INVALID, B, "", 0)
|
||||
OPTION("--preprocess", _preprocess, Flag, INVALID, E, "", 0)
|
||||
|
@ -221,7 +224,7 @@ OPTION("-B", B, JoinedOrSeparate, INVALID, INVALID, "u", 0)
|
|||
OPTION("-CC", CC, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-C", C, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-D", D, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-E", E, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-E", E, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-F", F, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-H", H, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-I-", I_, Flag, I_Group, INVALID, "", 0)
|
||||
|
@ -237,14 +240,14 @@ OPTION("-MQ", MQ, JoinedOrSeparate, M_Group, INVALID, "", 0)
|
|||
OPTION("-MT", MT, JoinedOrSeparate, M_Group, INVALID, "", 0)
|
||||
OPTION("-Mach", Mach, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-M", M, Flag, M_Group, INVALID, "", 0)
|
||||
OPTION("-ObjC++", ObjCXX, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-ObjC", ObjC, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-ObjC++", ObjCXX, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-ObjC", ObjC, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-O", O, Joined, INVALID, INVALID, "", 0)
|
||||
OPTION("-P", P, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-Qn", Qn, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-Q", Q, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-R", R, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-S", S, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-S", S, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-Tbss", Tbss, JoinedOrSeparate, T_Group, INVALID, "", 0)
|
||||
OPTION("-Tdata", Tdata, JoinedOrSeparate, T_Group, INVALID, "", 0)
|
||||
OPTION("-Ttext", Ttext, JoinedOrSeparate, T_Group, INVALID, "", 0)
|
||||
|
@ -277,19 +280,19 @@ OPTION("-Z", Z, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
|||
OPTION("-all_load", all__load, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-allowable_client", allowable__client, Separate, INVALID, INVALID, "", 0)
|
||||
OPTION("-ansi", ansi, Flag, a_Group, INVALID, "", 0)
|
||||
OPTION("-arch", arch, Separate, INVALID, INVALID, "", 0)
|
||||
OPTION("-arch", arch, Separate, INVALID, INVALID, "d", 0)
|
||||
OPTION("-a", a, Joined, a_Group, INVALID, "", 0)
|
||||
OPTION("-bind_at_load", bind__at__load, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-bundle_loader", bundle__loader, Separate, INVALID, INVALID, "", 0)
|
||||
OPTION("-bundle", bundle, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-b", b, JoinedOrSeparate, INVALID, INVALID, "u", 0)
|
||||
OPTION("-client_name", client__name, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-combine", combine, Flag, INVALID, INVALID, "u", 0)
|
||||
OPTION("-combine", combine, Flag, INVALID, INVALID, "du", 0)
|
||||
OPTION("-compatibility_version", compatibility__version, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-coverage", coverage, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-cpp-precomp", cpp_precomp, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-current_version", current__version, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-c", c, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-c", c, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-dA", dA, Flag, d_Group, INVALID, "", 0)
|
||||
OPTION("-dM", dM, Flag, d_Group, INVALID, "", 0)
|
||||
OPTION("-dead_strip", dead__strip, Flag, INVALID, INVALID, "", 0)
|
||||
|
@ -366,7 +369,7 @@ OPTION("-fprint-source-range-info", fprint_source_range_info, Flag, clang_f_Grou
|
|||
OPTION("-fprofile-arcs", fprofile_arcs, Flag, f_Group, INVALID, "", 0)
|
||||
OPTION("-fprofile-generate", fprofile_generate, Flag, f_Group, INVALID, "", 0)
|
||||
OPTION("-framework", framework, Separate, INVALID, INVALID, "l", 0)
|
||||
OPTION("-fsyntax-only", fsyntax_only, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-fsyntax-only", fsyntax_only, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-ftemplate-depth-", ftemplate_depth_, Joined, f_Group, INVALID, "", 0)
|
||||
OPTION("-fterminated-vtables", fterminated_vtables, Flag, f_Group, INVALID, "", 0)
|
||||
OPTION("-ftime-report", ftime_report, Flag, clang_f_Group, INVALID, "", 0)
|
||||
|
@ -442,7 +445,7 @@ OPTION("-mwarn-nonportable-cfstrings", mwarn_nonportable_cfstrings, Flag, m_Grou
|
|||
OPTION("-m", m_Separate, Separate, m_Group, INVALID, "", 0)
|
||||
OPTION("-m", m_Joined, Joined, m_Group, INVALID, "", 0)
|
||||
OPTION("-no-cpp-precomp", no_cpp_precomp, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-no-integrated-cpp", no_integrated_cpp, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-no-integrated-cpp", no_integrated_cpp, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-no_dead_strip_inits_and_terms", no__dead__strip__inits__and__terms, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-nodefaultlibs", nodefaultlibs, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-nofixprebinding", nofixprebinding, Flag, INVALID, INVALID, "", 0)
|
||||
|
@ -453,7 +456,7 @@ OPTION("-nostartfiles", nostartfiles, Flag, INVALID, INVALID, "", 0)
|
|||
OPTION("-nostdinc", nostdinc, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-nostdlib", nostdlib, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-object", object, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-o", o, JoinedOrSeparate, INVALID, INVALID, "i", 0)
|
||||
OPTION("-o", o, JoinedOrSeparate, INVALID, INVALID, "di", 0)
|
||||
OPTION("-pagezero_size", pagezero__size, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-pass-exit-codes", pass_exit_codes, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-pedantic-errors", pedantic_errors, Flag, pedantic_Group, INVALID, "", 0)
|
||||
|
@ -477,7 +480,7 @@ OPTION("-p", p, Flag, INVALID, INVALID, "", 0)
|
|||
OPTION("-read_only_relocs", read__only__relocs, Separate, INVALID, INVALID, "", 0)
|
||||
OPTION("-remap", remap, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-r", r, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-save-temps", save_temps, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-save-temps", save_temps, Flag, INVALID, INVALID, "d", 0)
|
||||
OPTION("-sectalign", sectalign, MultiArg, INVALID, INVALID, "", 3)
|
||||
OPTION("-sectcreate", sectcreate, MultiArg, INVALID, INVALID, "", 3)
|
||||
OPTION("-sectobjectsymbols", sectobjectsymbols, MultiArg, INVALID, INVALID, "", 2)
|
||||
|
@ -523,5 +526,5 @@ OPTION("-weak_reference_mismatches", weak__reference__mismatches, Separate, INVA
|
|||
OPTION("-whatsloaded", whatsloaded, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-whyload", whyload, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-w", w, Flag, INVALID, INVALID, "", 0)
|
||||
OPTION("-x", x, JoinedOrSeparate, INVALID, INVALID, "", 0)
|
||||
OPTION("-x", x, JoinedOrSeparate, INVALID, INVALID, "d", 0)
|
||||
OPTION("-y", y, Joined, INVALID, INVALID, "", 0)
|
||||
|
|
|
@ -29,7 +29,7 @@ struct Info {
|
|||
|
||||
static Info OptionInfos[] = {
|
||||
// The InputOption info
|
||||
{ "<input>", "", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
{ "<input>", "d", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
// The UnknownOption info
|
||||
{ "<unknown>", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
|
||||
|
@ -107,14 +107,24 @@ Option *OptTable::constructOption(options::ID id) const {
|
|||
for (const char *s = info.Flags; *s; ++s) {
|
||||
switch (*s) {
|
||||
default: assert(0 && "Invalid option flag.");
|
||||
case 'J': Opt->setForceJoinedRender(true); break;
|
||||
case 'S': Opt->setForceSeparateRender(true); break;
|
||||
case 'J':
|
||||
assert(info.Kind == Option::SeparateClass && "Invalid option.");
|
||||
Opt->setForceJoinedRender(true); break;
|
||||
case 'S':
|
||||
assert(info.Kind == Option::JoinedClass && "Invalid option.");
|
||||
Opt->setForceSeparateRender(true); break;
|
||||
case 'd': Opt->setForwardToGCC(false); break;
|
||||
case 'i': Opt->setNoOptAsInput(true); break;
|
||||
case 'l': Opt->setLinkerInput(true); break;
|
||||
case 'u': Opt->setUnsupported(true); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Linker inputs shouldn't be forwarded to GCC as arguments (they
|
||||
// will, however, be forwarded as inputs).
|
||||
if (Opt->isLinkerInput())
|
||||
Opt->setForwardToGCC(false);
|
||||
|
||||
return Opt;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ Option::Option(OptionClass _Kind, options::ID _ID, const char *_Name,
|
|||
const OptionGroup *_Group, const Option *_Alias)
|
||||
: Kind(_Kind), ID(_ID), Name(_Name), Group(_Group), Alias(_Alias),
|
||||
Unsupported(false), LinkerInput(false), NoOptAsInput(false),
|
||||
ForceSeparateRender(false), ForceJoinedRender(false)
|
||||
ForceSeparateRender(false), ForceJoinedRender(false),
|
||||
ForwardToGCC(true)
|
||||
{
|
||||
|
||||
// Multi-level aliases are not supported, and alias options cannot
|
||||
|
|
Loading…
Reference in New Issue