[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for compare() (PR #89530)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 21 07:39:56 PDT 2024


================
@@ -16,6 +16,49 @@
 using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
+namespace {
+// Given two argument indices X and Y, matches when a call expression has a
+// string at index X with an expression representing that string's length at
+// index Y. The string can be a string literal or a variable. The length can be
+// matched via an integer literal or a call to strlen() in the case of a string
+// literal, and by a call to size() or length() in the string variable case.
+AST_POLYMORPHIC_MATCHER_P2(HasStringAndLengthArguments,
----------------
PiotrZSL wrote:

HasStringAndLengthArguments -> hasStringAndLengthArguments

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


More information about the cfe-commits mailing list