[clang-tools-extra] [clang-tidy][readability-named-parameter] Add an option to print names without comment (PR #147953)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 08:16:39 PDT 2025


================
@@ -105,12 +117,26 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
           NewName = Name;
       }
 
-      // Now insert the comment. Note that getLocation() points to the place
+      // Now insert the fix. Note that getLocation() points to the place
       // where the name would be, this allows us to also get complex cases like
       // function pointers right.
       const ParmVarDecl *Parm = P.first->getParamDecl(P.second);
-      D << FixItHint::CreateInsertion(Parm->getLocation(),
-                                      " /*" + NewName.str() + "*/");
+
+      // The fix depends on the InsertPlainNamesInForwardDecls option,
+      // whether this is a forward declaration and whether the parameter has
+      // a real name.
+      bool IsForwardDeclaration = (!Definition || Function != Definition);
----------------
EugeneZelenko wrote:

Should be `const`.

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


More information about the cfe-commits mailing list