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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 15 11:16:51 PST 2016


aaron.ballman accepted this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tidy/modernize/UseTransparentFunctorsCheck.cpp:89
+    diag(FuncInst->getLocStart(), Message)
+        << (FuncClass->getName() + "<>").str();
+    return;
----------------
xazax.hun wrote:
> aaron.ballman wrote:
> > Is the `.str()` required? (Same question applies below.)
> It does not compile without it. It looks like the << is not overloaded for Twine.
I learn something new every day. ;-)


================
Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:8
+functors, the type does not need to be repeated. The code is easier to read,
+maintain and less prone to errors. It not possible to introduce unwanted
+conversions.
----------------
It not possible -> It is not possible


================
Comment at: docs/clang-tidy/checks/modernize-use-transparent-functors.rst:35-37
+   If the option is set to non-zero (default is `0`), the check will not
+   warn on these cases as shown above, where automatic FIXIT is not safe to
+   apply.
----------------
The way I read this, it seems to be claiming that if you set `SafeMode` to nonzero, the check never warns. How about:
```
   If the option is set to non-zero, the check will not diagnose cases where using a transparent functor cannot be guaranteed to produce identical results as the original code. The default value for this option is `0`.
```


https://reviews.llvm.org/D24894





More information about the cfe-commits mailing list