[PATCH] D24894: [clang-tidy] Prefer transparent functors to non-transparent one.

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 22 09:26:24 PDT 2016


xazax.hun added inline comments.


================
Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:26
+      unless(hasAnyTemplateArgument(refersToType(voidType()))),
+      hasAnyName("::std::plus", "::std::minus", "::std::multiplies",
+                 "::std::divides", "::std::modulus", "::std::negate",
----------------
aaron.ballman wrote:
> Should we make this a configurable list that users can add to?
I am not sure how frequent is that somebody would like to add some types to this list, but it can be added in a follow up patch.


================
Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:61
+          Result.Nodes.getNodeAs<CXXConstructExpr>("FuncInst")) {
+    diag(FuncInst->getLocStart(), "prefer transparent functors");
+    return;
----------------
aaron.ballman wrote:
> This diagnostic is too terse; anyone that is unaware of what a transparent functor is will likely be stumped by it, especially since there is no fixit.
> 
> Since this is the case where we cannot be sure that a transparent functor is the correct solution, should this be enabled via an option (default on)?
I also extended the error message to refer to the alternative name (diamond operators) as well. 

I did add an option but I am not happy with the name of the option. Do you have a suggestion?


https://reviews.llvm.org/D24894





More information about the cfe-commits mailing list