[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 08:56:53 PDT 2024


================
@@ -5121,11 +5142,12 @@ AST_POLYMORPHIC_MATCHER_P2(forEachArgumentWithParamType,
   // argument of the method which should not be matched against a parameter, so
   // we skip over it here.
   BoundNodesTreeBuilder Matches;
-  unsigned ArgIndex = cxxOperatorCallExpr(callee(cxxMethodDecl()))
-                              .matches(Node, Finder, &Matches)
-                          ? 1
-                          : 0;
-
+  unsigned ArgIndex =
+      cxxOperatorCallExpr(
+          callee(cxxMethodDecl(unless(isExplicitObjectMemberFunction()))))
+              .matches(Node, Finder, &Matches)
+          ? 1
+          : 0;
----------------
steakhal wrote:

I don't feel confident of making changes like that.
It appears to me that the `callee` matchers does a bit more than a couple `dyn_casts`, so unless strictly necessary, I'd opt out for doing that.

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


More information about the cfe-commits mailing list