Skip to content

Commit d2cd620

Browse files
committed
Do not warn about unused plugin flags.
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.
1 parent 0edb5c3 commit d2cd620

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,14 +3645,14 @@ defm rwpi : BoolFOption<"rwpi",
36453645
"Generate read-write position independent code (ARM only)">,
36463646
NegFlag<SetFalse, [], [ClangOption, FlangOption, CC1Option]>>;
36473647
def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>,
3648-
Flags<[NoXarchOption]>, MetaVarName<"<dsopath>">,
3648+
Flags<[NoXarchOption, NoArgumentUnused]>, MetaVarName<"<dsopath>">,
36493649
HelpText<"Load the named plugin (dynamic shared object)">;
36503650
def fplugin_arg : Joined<["-"], "fplugin-arg-">,
3651-
MetaVarName<"<name>-<arg>">,
3651+
MetaVarName<"<name>-<arg>">, Flags<[NoArgumentUnused]>,
36523652
HelpText<"Pass <arg> to plugin <name>">;
36533653
def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
36543654
Group<f_Group>, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
3655-
MetaVarName<"<dsopath>">,
3655+
MetaVarName<"<dsopath>">, Flags<[NoArgumentUnused]>,
36563656
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">,
36573657
MarshallingInfoStringVector<CodeGenOpts<"PassPlugins">>;
36583658
defm tocdata : BoolOption<"m","tocdata",

clang/test/Driver/clang-s-plugin.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang -### -c -fpass-plugin=bar.so -fplugin=bar.so -fplugin-arg-bar-option -Werror %s 2>&1 | FileCheck %s
2+
3+
// Plugins are only relevant for the -cc1 phase. No warning should be raised
4+
// when applied to assembly files. See GH #88173.
5+
// CHECK-NOT: argument unused during compilation

0 commit comments

Comments
 (0)