[clang-tools-extra] [clang-tidy] Ignore non-forwarded arguments if they are unnamed (PR #87832)

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 7 04:54:01 PDT 2024


================
@@ -125,12 +127,13 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) {
                    hasAncestor(expr(hasUnevaluatedContext())))));
 
   Finder->addMatcher(
-      parmVarDecl(parmVarDecl().bind("param"), isTemplateTypeParameter(),
-                  hasAncestor(functionDecl().bind("func")),
-                  hasAncestor(functionDecl(
-                      isDefinition(), equalsBoundNode("func"), ToParam,
-                      unless(anyOf(isDeleted(), hasDescendant(std::move(
-                                                    ForwardCallMatcher))))))),
+      parmVarDecl(
+          parmVarDecl().bind("param"), hasAnyName(), isTemplateTypeParameter(),
----------------
SimplyDanny wrote:

I went with `unless(hasAttr(attr::Kind::Unused))` and `hasIdentifier`. `isReferenced()` doesn't play to nicely with constructor initializer lists. It seems that it doesn't consider a declaration used when it's only used to initialize a field.

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


More information about the cfe-commits mailing list