diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 182f7bc5c936..247e1f5117f9 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -17,23 +17,27 @@ include "OptParser.td" ///////// // Groups -def I_Group : OptionGroup<"">; -def M_Group : OptionGroup<"">; +// Meta-group which defines +def CompileOnly_Group : OptionGroup<"">; + +def I_Group : OptionGroup<"">, Group; +def M_Group : OptionGroup<"">, Group; def T_Group : OptionGroup<"">; -def O_Group : OptionGroup<"">; -def W_Group : OptionGroup<"">; +def O_Group : OptionGroup<"">, Group; +def W_Group : OptionGroup<"">, Group; def X_Group : OptionGroup<"">; def a_Group : OptionGroup<"">; def d_Group : OptionGroup<"">; -def f_Group : OptionGroup<"">; +def f_Group : OptionGroup<"">, Group; def g_Group : OptionGroup<"">; -def i_Group : OptionGroup<"">; +def i_Group : OptionGroup<"">, Group; def clang_i_Group : OptionGroup<"">, Group; -def m_Group : OptionGroup<"">; -def m_x86_Features_Group : OptionGroup<"">; +def m_Group : OptionGroup<"">, Group; +def m_x86_Features_Group : OptionGroup<"">, Group; def u_Group : OptionGroup<"">; -def pedantic_Group : OptionGroup<"">; +def pedantic_Group : OptionGroup<"">, + Group; // Temporary groups for clang options which we know we don't support, // but don't want to verbosely warn the user about. @@ -116,7 +120,7 @@ def A : JoinedOrSeparate<"-A">; def B : JoinedOrSeparate<"-B">, Flags<[Unsupported]>; def CC : Flag<"-CC">; def C : Flag<"-C">; -def D : JoinedOrSeparate<"-D">; +def D : JoinedOrSeparate<"-D">, Group; def E : Flag<"-E">, Flags<[DriverOption]>, HelpText<"Only run the preprocessor">; def F : JoinedOrSeparate<"-F">; @@ -152,7 +156,7 @@ def Tbss : JoinedOrSeparate<"-Tbss">, Group; def Tdata : JoinedOrSeparate<"-Tdata">, Group; def Ttext : JoinedOrSeparate<"-Ttext">, Group; def T : JoinedOrSeparate<"-T">, Group; -def U : JoinedOrSeparate<"-U">; +def U : JoinedOrSeparate<"-U">, Group; def V : JoinedOrSeparate<"-V">, Flags<[DriverOption, Unsupported]>; def Wa_COMMA : CommaJoined<"-Wa,">, HelpText<"Pass the comma separated arguments in to the assembler">, diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index dbe7bd9b682d..c7eaad338c84 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -711,6 +711,11 @@ void Driver::BuildActions(const ArgList &Args, ActionList &Actions) const { // Add a link action if necessary. if (!LinkerInputs.empty()) Actions.push_back(new LinkJobAction(LinkerInputs, types::TY_Image)); + + // If we are linking, claim any options which are obviously only used for + // compilation. + if (FinalPhase == phases::Link) + Args.ClaimAllArgs(options::OPT_CompileOnly_Group); } Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,