aaron.ballman added inline comments.
================
Comment at: clang-tidy/modernize/ReplaceGenericFunctorCallCheck.cpp:27-32
+ // template<class T>
+ // void f(T func) {
+ // func();
+ // ^~~~~~~
+ // ::std::invoke(func, 1)
+ Finder->addMatcher(callExpr(has(declRefExpr())).bind("functor"), this);
----------------
lebedev.ri wrote:
> Bikeshedding: i do not understand the idea behind `std::invoke`.
> Why is the new version better/preferred?
It generically handles all the various kinds of "callable" objects (lambdas,
functors, function pointers, pointer to member functions, etc).
================
Comment at: clang-tidy/modernize/ReplaceGenericFunctorCallCheck.cpp:97-99
+ std::ostringstream Replace;
+ Replace << "::std::invoke(" << Param
+ << (Functor->getNumArgs() == 0 ? "" : ", ") << OriginalParams;
----------------
This should use a `Twine` instead.
================
Comment at: clang-tidy/modernize/ReplaceGenericFunctorCallCheck.h:19
+
+/// Use std::invoke to call callable objects in generic code
+///
----------------
Missing full stop at the end of the comment.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D52281
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits