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

Tommy Chen via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 21:35:47 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()))),
----------------
dl8sd11 wrote:

I tried to match the two arguments but I fail to remove the second argument in the Fixit hint. Could you suggest how to get the location after the first argument. I tried binding the first argument (e.g. "test"), but the source range seems to be the first character (") instead of the whole argument ("test").

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


More information about the cfe-commits mailing list