-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Tooling] -fsyntax-only adjuster: remove -c and -S #101103
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
[Tooling] -fsyntax-only adjuster: remove -c and -S #101103
Conversation
Created using spr 1.3.5-bogner
@llvm/pr-subscribers-clang Author: Fangrui Song (MaskRay) Changescompile_commands.json entries often have -c. When adding -fsyntax-only,
Previously, -c and -S were inappropriately claimed in Fix #100909 Full diff: https://github.com/llvm/llvm-project/pull/101103.diff 2 Files Affected:
diff --git a/clang/lib/Tooling/ArgumentsAdjusters.cpp b/clang/lib/Tooling/ArgumentsAdjusters.cpp
index df4c74205b087..d01c57ee69c00 100644
--- a/clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ b/clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -49,10 +49,11 @@ ArgumentsAdjuster getClangSyntaxOnlyAdjuster() {
}))
continue;
- if (!Arg.starts_with("-fcolor-diagnostics") &&
+ if (Arg != "-c" && Arg != "-S" &&
+ !Arg.starts_with("-fcolor-diagnostics") &&
!Arg.starts_with("-fdiagnostics-color"))
AdjustedArgs.push_back(Args[i]);
- // If we strip a color option, make sure we strip any preceeding `-Xclang`
+ // If we strip an option, make sure we strip any preceeding `-Xclang`
// option as well.
// FIXME: This should be added to most argument adjusters!
else if (!AdjustedArgs.empty() && AdjustedArgs.back() == "-Xclang")
diff --git a/clang/test/Tooling/clang-check-extra-arg.cpp b/clang/test/Tooling/clang-check-extra-arg.cpp
index df5fb930eedcd..488497edd4e81 100644
--- a/clang/test/Tooling/clang-check-extra-arg.cpp
+++ b/clang/test/Tooling/clang-check-extra-arg.cpp
@@ -1,4 +1,6 @@
-// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -c 2>&1 | FileCheck %s
+/// Check we do not report "argument unused during compilation: '-c'"
+// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -c 2>&1 | FileCheck %s --implicit-check-not='argument unused'
+// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -S -Xclang -S 2>&1 | FileCheck %s --implicit-check-not='argument unused'
// CHECK: unknown warning option '-Wunimplemented-warning-before'
// CHECK: unknown warning option '-Wunimplemented-warning'
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…uppress warnings from -Wunused-command-line-argument After llvm/llvm-project#101103, clang will no longer accept mixing `-S` and `-c`. An upstream discussion on shows that this was intentional, and is unlikely to be reverted: llvm/llvm-project#104347. It also does not appear to be possible to remove the `-c` option from the compiler command. As a compromise, we opt out of the option warning so that -Werror will continue to work. Original-Fixed: 359934302 Original-Bug: 360223478 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/Vulkan-Loader/+/1101677 Original-Revision: 710b06e7ff8e672b7359489fe4906f705c2761d4 GitOrigin-RevId: fbf6944d66d8a02abda9b9be33273474892cf8ca Roller-URL: https://ci.chromium.org/b/8737682620244722209 CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Id30dc4ede3d83fecd4d6407cd4927f9520231030 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1113304
…warnings from -Wunused-command-line-argument After llvm/llvm-project#101103, clang will no longer accept mixing `-S` and `-c`. An upstream discussion on shows that this was intentional, and is unlikely to be reverted: llvm/llvm-project#104347. It also does not appear to be possible to remove the `-c` option from the compiler command. As a compromise, we opt out of the option warning so that -Werror will continue to work. Original-Fixed: 359934302 Original-Bug: 360223478 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/Vulkan-Loader/+/1101677 Original-Revision: 710b06e7ff8e672b7359489fe4906f705c2761d4 GitOrigin-RevId: fbf6944d66d8a02abda9b9be33273474892cf8ca Change-Id: Ib5b0e17ccf55c9746f6b9b126a93bbfbe8ab0f65
…ang][VulkanLoader] Suppress warnings from -Wunused-command-line-argument After llvm/llvm-project#101103, clang will no longer accept mixing `-S` and `-c`. An upstream discussion on shows that this was intentional, and is unlikely to be reverted: llvm/llvm-project#104347. It also does not appear to be possible to remove the `-c` option from the compiler command. As a compromise, we opt out of the option warning so that -Werror will continue to work. Original-Fixed: 359934302 Original-Bug: 360223478 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/Vulkan-Loader/+/1101677 Original-Revision: 710b06e7ff8e672b7359489fe4906f705c2761d4 GitOrigin-RevId: 33e2ce9b6ea925b58f20b89d10d8f3ef8a838e0d Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1113304 Original-Revision: 8ec9fa67ddc9f24e3d859725e46833f871e58a34 Change-Id: I73cb9e794d9c8ae6227ca592679a816b1189961b
compile_commands.json entries often have -c. When adding -fsyntax-only,
we should remove -c to prevent the following warning:
Previously, -c and -S were inappropriately claimed in
addPGOAndCoverageFlags
(see the workaround added by commita07b135). Now the workaround have been
removed (#98607). (clangDriver reports a -Wunused-command-line-argument
diagnostic for each unclaimed option.)
Fix #100909