[clang-tools-extra] [clang-tidy] support string::contains (PR #110351)

Nicolas van Kempen via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 28 13:36:21 PDT 2024


================
@@ -32,7 +33,8 @@ void ContainerContainsCheck::registerMatchers(MatchFinder *Finder) {
 
   const auto FindCall =
       cxxMemberCallExpr(
-          argumentCountIs(1),
+          anyOf(argumentCountIs(1),
+                allOf(argumentCountIs(2), hasArgument(1, cxxDefaultArgExpr()))),
----------------
nicovank wrote:

Maybe a comment here saying `std::string` and `std::string_view` take an optional `pos` argument on where to start the search. Also match `ignoringParenImpCasts(integerLiteral(0))`?

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


More information about the cfe-commits mailing list