[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

Nicolas van Kempen via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 07:48:52 PST 2023


nicovank wrote:

> Detect the `str.compare("marker", 0, 6) == 0` pattern.

This is actually in my notes for making this check / codemod. No performance impact so not tackling yet, maybe in the future.

> Support `ends_with` in same check.

Similar as above, matching for that length argument is a bit trickier than just looking for 0. Not tackling for now. Any thoughts on open-ended check name instead? `modernize-string-find-affix` (affix = prefix | suffix)?

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


More information about the cfe-commits mailing list