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

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 23 02:58:27 PDT 2016


Prazek added inline comments.


================
Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:70
+static const StringRef Message =
+    "prefer transparent functors (aka diamond operators)";
+
----------------
The message would be much better if you would put the name of this functor, like
"prefer transparent functor (%0)" where %0 would be evaluated to 'std::greater<>" etc.


================
Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:89-109
+  for (; ArgNum < FunctorParentLoc.getNumArgs(); ++ArgNum) {
+    const TemplateArgument &Arg =
+        FunctorParentLoc.getArgLoc(ArgNum).getArgument();
+    if (Arg.getKind() != TemplateArgument::Type)
+      continue;
+    QualType ParentArgType = Arg.getAsType();
+    if (ParentArgType->isRecordType() &&
----------------
This can be moved to one or 2 functions, returning FunctorTypeLoc or llvm::Optional<TemplateSpecializationTypeLoc>


================
Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:32-33
+
+   If the option is set to non-zero (default is `0`), the check will not
+   warn on those cases where automatic FIXIT is not safe to apply.
----------------
I think
... will not warn on these cases as shown above, where automatic FIXIT...
would have been better.


================
Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:33
+   If the option is set to non-zero (default is `0`), the check will not
+   warn on those cases where automatic FIXIT is not safe to apply.
----------------
Add a note
This check requires C++14 or higher to run.


https://reviews.llvm.org/D24894





More information about the cfe-commits mailing list