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

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 06:26:52 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;
----------------
PiotrZSL wrote:

Legacy: this will be slow, better would be to rewrite this using simple code like.
`dyn_cast<CXXOperatorCallExpr>`, getCallee ...

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


More information about the cfe-commits mailing list