Skip to content

Commit

Permalink
Do not warn about unused plugin flags.
Browse files Browse the repository at this point in the history
Plugins are not loaded without the -cc1 phase. Do not report them when
running on a assembly file or when linking. Many build tools add these
options to all driver invocations. See GH #88173.
  • Loading branch information
Meinersbur committed Apr 30, 2024
1 parent 0edb5c3 commit d2cd620
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3645,14 +3645,14 @@ defm rwpi : BoolFOption<"rwpi",
"Generate read-write position independent code (ARM only)">,
NegFlag<SetFalse, [], [ClangOption, FlangOption, CC1Option]>>;
def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>,
Flags<[NoXarchOption]>, MetaVarName<"<dsopath>">,
Flags<[NoXarchOption, NoArgumentUnused]>, MetaVarName<"<dsopath>">,
HelpText<"Load the named plugin (dynamic shared object)">;
def fplugin_arg : Joined<["-"], "fplugin-arg-">,
MetaVarName<"<name>-<arg>">,
MetaVarName<"<name>-<arg>">, Flags<[NoArgumentUnused]>,
HelpText<"Pass <arg> to plugin <name>">;
def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
Group<f_Group>, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
MetaVarName<"<dsopath>">,
MetaVarName<"<dsopath>">, Flags<[NoArgumentUnused]>,
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">,
MarshallingInfoStringVector<CodeGenOpts<"PassPlugins">>;
defm tocdata : BoolOption<"m","tocdata",
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Driver/clang-s-plugin.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %clang -### -c -fpass-plugin=bar.so -fplugin=bar.so -fplugin-arg-bar-option -Werror %s 2>&1 | FileCheck %s

// Plugins are only relevant for the -cc1 phase. No warning should be raised
// when applied to assembly files. See GH #88173.
// CHECK-NOT: argument unused during compilation

0 comments on commit d2cd620

Please sign in to comment.