MaskRay updated this revision to Diff 292989.
MaskRay retitled this revision from "[Driver] Add disabled-by-default 
-Wuse-ld-non-word for the deprecation warning for -fuse-ld=/abs/path" to 
"[Driver] Add disabled-by-default -Wuse-ld-path for the deprecation warning for 
-fuse-ld=/abs/path".
MaskRay edited the summary of this revision.
MaskRay added a comment.

Adopt dblaikie's suggestion: -Wfuse-ld-path


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87837/new/

https://reviews.llvm.org/D87837

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/fuse-ld.c
  clang/test/Misc/warning-flags.c


Index: clang/test/Misc/warning-flags.c
===================================================================
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -47,7 +47,6 @@
 CHECK-NEXT:   warn_drv_assuming_mfloat_abi_is
 CHECK-NEXT:   warn_drv_clang_unsupported
 CHECK-NEXT:   warn_drv_pch_not_first_include
-CHECK-NEXT:   warn_drv_use_ld_non_word
 CHECK-NEXT:   warn_dup_category_def
 CHECK-NEXT:   warn_enum_value_overflow
 CHECK-NEXT:   warn_expected_qualified_after_typename
Index: clang/test/Driver/fuse-ld.c
===================================================================
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -1,10 +1,18 @@
-// RUN: %clang %s -### \
-// RUN:     -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 \
-// RUN:     -target x86_64-unknown-linux \
-// RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+/// The absolute path warning is enabled by -Wfuse-ld-path and -Wextra.
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wfuse-ld-path \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: warning: '-fuse-ld=' taking a path is deprecated. Use 
'--ld-path=' instead
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wextra \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+
+// RUN: %clang %s -### -target x86_64-unknown-linux \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
+// CHECK-NO-WARN-NOT: warning:
 
 // RUN: %clang %s -### \
 // RUN:     -target x86_64-unknown-freebsd 2>&1 \
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -581,7 +581,7 @@
   // to a relative path is surprising. This is more complex due to priorities
   // among -B, COMPILER_PATH and PATH. --ld-path= should be used instead.
   if (UseLinker.find('/') != StringRef::npos)
-    getDriver().Diag(diag::warn_drv_use_ld_non_word);
+    getDriver().Diag(diag::warn_drv_fuse_ld_path);
 
   if (llvm::sys::path::is_absolute(UseLinker)) {
     // If we're passed what looks like an absolute path, don't attempt to
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -869,6 +869,8 @@
 def PointerToIntCast : DiagGroup<"pointer-to-int-cast",
                                  [PointerToEnumCast, VoidPointerToIntCast]>;
 
+def FUseLdPath : DiagGroup<"fuse-ld-path">;
+
 def Move : DiagGroup<"move", [
     PessimizingMove,
     RedundantMove,
@@ -887,7 +889,8 @@
     UnusedParameter,
     NullPointerArithmetic,
     EmptyInitStatement,
-    StringConcatation
+    StringConcatation,
+    FUseLdPath,
   ]>;
 
 def Most : DiagGroup<"most", [
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -463,8 +463,9 @@
   "try running Clang from a developer command prompt">,
   InGroup<DiagGroup<"msvc-not-found">>;
 
-def warn_drv_use_ld_non_word : Warning<
-  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">;
+def warn_drv_fuse_ld_path : Warning<
+  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">,
+  InGroup<FUseLdPath>, DefaultIgnore;
 
 def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
   "option '-ffine-grained-bitfield-accesses' cannot be enabled together with a 
sanitizer; flag ignored">,


Index: clang/test/Misc/warning-flags.c
===================================================================
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (69):
+CHECK: Warnings without flags (68):
 
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -47,7 +47,6 @@
 CHECK-NEXT:   warn_drv_assuming_mfloat_abi_is
 CHECK-NEXT:   warn_drv_clang_unsupported
 CHECK-NEXT:   warn_drv_pch_not_first_include
-CHECK-NEXT:   warn_drv_use_ld_non_word
 CHECK-NEXT:   warn_dup_category_def
 CHECK-NEXT:   warn_enum_value_overflow
 CHECK-NEXT:   warn_expected_qualified_after_typename
Index: clang/test/Driver/fuse-ld.c
===================================================================
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -1,10 +1,18 @@
-// RUN: %clang %s -### \
-// RUN:     -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 \
-// RUN:     -target x86_64-unknown-linux \
-// RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+/// The absolute path warning is enabled by -Wfuse-ld-path and -Wextra.
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wfuse-ld-path \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wextra \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+
+// RUN: %clang %s -### -target x86_64-unknown-linux \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
+// CHECK-NO-WARN-NOT: warning:
 
 // RUN: %clang %s -### \
 // RUN:     -target x86_64-unknown-freebsd 2>&1 \
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -581,7 +581,7 @@
   // to a relative path is surprising. This is more complex due to priorities
   // among -B, COMPILER_PATH and PATH. --ld-path= should be used instead.
   if (UseLinker.find('/') != StringRef::npos)
-    getDriver().Diag(diag::warn_drv_use_ld_non_word);
+    getDriver().Diag(diag::warn_drv_fuse_ld_path);
 
   if (llvm::sys::path::is_absolute(UseLinker)) {
     // If we're passed what looks like an absolute path, don't attempt to
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -869,6 +869,8 @@
 def PointerToIntCast : DiagGroup<"pointer-to-int-cast",
                                  [PointerToEnumCast, VoidPointerToIntCast]>;
 
+def FUseLdPath : DiagGroup<"fuse-ld-path">;
+
 def Move : DiagGroup<"move", [
     PessimizingMove,
     RedundantMove,
@@ -887,7 +889,8 @@
     UnusedParameter,
     NullPointerArithmetic,
     EmptyInitStatement,
-    StringConcatation
+    StringConcatation,
+    FUseLdPath,
   ]>;
 
 def Most : DiagGroup<"most", [
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -463,8 +463,9 @@
   "try running Clang from a developer command prompt">,
   InGroup<DiagGroup<"msvc-not-found">>;
 
-def warn_drv_use_ld_non_word : Warning<
-  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">;
+def warn_drv_fuse_ld_path : Warning<
+  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">,
+  InGroup<FUseLdPath>, DefaultIgnore;
 
 def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
   "option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to