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

Zachary Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 11:09:31 PST 2019


zturner updated this revision to Diff 230495.
zturner added a comment.

- Updated documentation for this check
- Incorporated additional suggestions from @aaron.ballman
- Fixed an invalid transformation that was generated when binding a member function and the second argument of `bind` (the object pointer) was a placeholder.  Test is added for this case as well.
- Fixed an invalid transformation that was generated when a placeholder index was entirely skipped, as in the call `std::bind(add, 0, _2);`  In this case we need to generate an unused placeholder in the first position of the resulting lambda's parameter list.
- Added a clang-tidy option `PermissiveParameterList` which appends `auto&&...` to the end of every lambda's placeholder list.  This is necessary in some situations to prevent clang-tidy from applying a fixit that causes the code to no longer compile.


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

https://reviews.llvm.org/D70368

Files:
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.h
  clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind-permissive-parameter-list.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70368.230495.patch
Type: text/x-patch
Size: 42279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191121/0638ac3a/attachment-0001.bin>


More information about the cfe-commits mailing list