[PATCH] D70368: [clang-tidy] Rewrite modernize-avoid-bind check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 11:27:30 PST 2019


Eugene.Zelenko added a comment.

Changes should be also reflected in Release Notes.



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:7
+The check finds uses of ``std::bind`` and ``boost::bind`` and replaces them
+with lambdas.  Lambdas will use value-capture unless reference capture is
+explicitly requested with ``std::ref`` or ``boost::ref``.
----------------
Please fix double space. Same in other places.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:12
+and free functions, and all variations thereof.  Anything that you can pass
+to the first argument of `bind` should be diagnosable.  Currently, the only
+known case where a fixit is unsupported is when the same placeholder is
----------------
Please use double back-ticks for bind.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:13
+to the first argument of `bind` should be diagnosable.  Currently, the only
+known case where a fixit is unsupported is when the same placeholder is
+specified multiple times in the parameter list.
----------------
fixit -> fix-it.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:49
+
+  If the option is set to non-zero, the check will append `auto&&...` to the end
+  of every placeholder parameter list.  Without this, it is possible for a fixit
----------------
Please use double back-ticks for auto&&....


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:50
+  If the option is set to non-zero, the check will append `auto&&...` to the end
+  of every placeholder parameter list.  Without this, it is possible for a fixit
+  to perform an incorrect transformation in the case where the result of the bind
----------------
fixit -> fix-it.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:51
+  of every placeholder parameter list.  Without this, it is possible for a fixit
+  to perform an incorrect transformation in the case where the result of the bind
+  is used in the context of a type erased functor such as ``std::function`` which
----------------
Please use double back-ticks for bind.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:64
+
+is valid code, and returns `4`.  The actual values passed to `ignore_args` are
+simply ignored.  Without `PermissiveParameterList`, this would be transformed into
----------------
Please use double back-ticks for ignore_args.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst:75
+
+which will *not* compile, since the lambda does not contain an `operator()` that
+that accepts 2 arguments.  With permissive parameter list, it instead generates
----------------
Please use double back-ticks for operator().


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70368/new/

https://reviews.llvm.org/D70368





More information about the cfe-commits mailing list