Skip to content

Commit 6e31a49

Browse files
authored
[driver] Do not warn about unused plugin flags. (#88948)
Plugins are not loaded without the -cc1 phase. Do not report them when running on an assembly file or when linking. Many build tools add these options to all driver invocations, including LLVM's build system. Fixes #88173
1 parent e365ac8 commit 6e31a49

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
@@ -3663,14 +3663,14 @@ defm rwpi : BoolFOption<"rwpi",
36633663
"Generate read-write position independent code (ARM only)">,
36643664
NegFlag<SetFalse, [], [ClangOption, FlangOption, CC1Option]>>;
36653665
def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>,
3666-
Flags<[NoXarchOption]>, MetaVarName<"<dsopath>">,
3666+
Flags<[NoXarchOption, NoArgumentUnused]>, MetaVarName<"<dsopath>">,
36673667
HelpText<"Load the named plugin (dynamic shared object)">;
36683668
def fplugin_arg : Joined<["-"], "fplugin-arg-">,
3669-
MetaVarName<"<name>-<arg>">,
3669+
MetaVarName<"<name>-<arg>">, Flags<[NoArgumentUnused]>,
36703670
HelpText<"Pass <arg> to plugin <name>">;
36713671
def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
36723672
Group<f_Group>, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
3673-
MetaVarName<"<dsopath>">,
3673+
MetaVarName<"<dsopath>">, Flags<[NoArgumentUnused]>,
36743674
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">,
36753675
MarshallingInfoStringVector<CodeGenOpts<"PassPlugins">>;
36763676
defm tocdata : BoolOption<"m","tocdata",

clang/test/Driver/plugin-driver-args.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@
2020

2121
// RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg-testname- -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PLUGIN-ARG2
2222
// CHECK-NO-PLUGIN-ARG2: missing plugin argument for plugin testname in -fplugin-arg-testname-
23+
24+
// Plugins are only relevant for the -cc1 phase. No warning should be raised
25+
// when only using the assembler. See GH #88173.
26+
// RUN: %clang -c -fpass-plugin=bar.so -fplugin=bar.so -fplugin-arg-bar-option -Werror -x assembler %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PLUGIN-ASM
27+
// CHECK-PLUGIN-ASM-NOT: argument unused during compilation

0 commit comments

Comments
 (0)