https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/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 >From e5b10d3eba126454824c9f6fac4a575e07366ae6 Mon Sep 17 00:00:00 2001 From: Michael Kruse <llvm-proj...@meinersbur.de> Date: Tue, 16 Apr 2024 19:50:35 +0200 Subject: [PATCH] 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. --- clang/include/clang/Driver/Options.td | 6 +++--- clang/test/Driver/clang-s-plugin.s | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Driver/clang-s-plugin.s diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index e24626913add76..c1d85c527d437b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3630,14 +3630,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", diff --git a/clang/test/Driver/clang-s-plugin.s b/clang/test/Driver/clang-s-plugin.s new file mode 100644 index 00000000000000..81169b7bc5bbc8 --- /dev/null +++ b/clang/test/Driver/clang-s-plugin.s @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits