[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
Fri Nov 15 13:08:45 PST 2024


================
@@ -171,10 +171,24 @@ void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) {
                              hasRHS(lengthExprForStringNode("needle")))))
           .bind("expr"),
       this);
+      Finder->addMatcher(
----------------
nicovank wrote:

For consistency, let's add the comment describing pattern (and separate from above with one newline):
```suggestion

  // Case 6: X.substr(0, LEN(Y)) [!=]= Y -> starts_with.
  Finder->addMatcher(
```

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


More information about the cfe-commits mailing list