[clang-tools-extra] [clang-tidy] Enhance modernize-use-starts-ends-with to handle substr patterns (PR #116033)

Nicolas van Kempen via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 17 18:16:38 PST 2024


================
@@ -36,221 +36,224 @@ void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss,
           string_like sl, string_like_camel slc, prefer_underscore_version puv,
           prefer_underscore_version_flip puvf) {
   s.find("a") == 0;
-  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of find() == 0
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with instead of find == [modernize-use-starts-ends-with]
----------------
nicovank wrote:

I wasn't clear, leave previous tests as-is, this PR is not changing the diagnostic message. If needed they can be adjusted in separate PR. It's fine for them to only match part of the diagnostic for succinctness.

https://github.com/llvm/llvm-project/pull/116033


More information about the cfe-commits mailing list