[clang-tools-extra] [clang-tidy] Reland "An option for conditional skipping overloaded functions in modernize-use-string-view" (PR #196387)
Zinovy Nis via cfe-commits
cfe-commits at lists.llvm.org
Sat May 9 01:40:54 PDT 2026
================
@@ -0,0 +1,147 @@
+// RUN: %check_clang_tidy -check-suffix=DONTCHECK \
+// RUN: -std=c++20-or-later %s modernize-use-string-view %t -- \
+// RUN: --config="{CheckOptions: {modernize-use-string-view.CheckOverloadedFunctions: false}}"
+
+// RUN: %check_clang_tidy -check-suffix=CHECK \
+// RUN: -std=c++20-or-later %s modernize-use-string-view %t -- \
+// RUN: --config="{CheckOptions: {modernize-use-string-view.CheckOverloadedFunctions: true}}"
+
+#include <string>
+#include <utility>
+
+namespace overload_funcs_redeclared {
+std::basic_string<char> overload(int);
+std::string overload(int);
+std::string overload(int) { return "int"; }
+// CHECK-MESSAGES-DONTCHECK:[[@LINE-1]]:1: warning: consider using 'std::string_view' to avoid unnecessary copying and allocations [modernize-use-string-view]
+// CHECK-MESSAGES-CHECK:[[@LINE-2]]:1: warning: consider using 'std::string_view' to avoid unnecessary copying and allocations [modernize-use-string-view]
----------------
irishrover wrote:
I see that a lot of tests still use `[checker-name]` in their check. I'd prefer to leave as it is here.
https://github.com/llvm/llvm-project/pull/196387
More information about the cfe-commits
mailing list