-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[driver] Do not warn about unused plugin flags. #88948
Conversation
@llvm/pr-subscribers-clang Author: Michael Kruse (Meinersbur) ChangesPlugins 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 Full diff: https://github.com/llvm/llvm-project/pull/88948.diff 2 Files Affected:
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
|
@llvm/pr-subscribers-clang-driver Author: Michael Kruse (Meinersbur) ChangesPlugins 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 Full diff: https://github.com/llvm/llvm-project/pull/88948.diff 2 Files Affected:
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
|
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 llvm#88173.
507a9f9
to
6e22e57
Compare
I accidentally pushed a Foxtrot merge. Will push once the pre-merge bot is happy. Thanks for the review. |
Hi, the test plugin-driver-args.cpp is failing on AIX now, could you take a look please? |
@jakeegan Sorry, didn't see you comment over an extended weekend. |
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