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

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 24 10:12:25 PST 2024


================
@@ -240,6 +240,9 @@ void UseStartsEndsWithCheck::check(const MatchFinder::MatchResult &Result) {
                                        ReplacementFunction->getName());
 
   // Replace arguments and everything after the function call.
+  if (FindExpr->getNumArgs() == 0) {
+    return;
+  }
----------------
5chmidti wrote:

IMO it should be after the diagnostic, before the first fixit, because the access to the first parameter is only needed to emit the fixit, not the warning. On the other hand, the situation should never occur.

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


More information about the cfe-commits mailing list