[PATCH] D81769: Repair various issues with modernize-avoid-bind

Jeff Trull via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 12 14:49:59 PDT 2020


jaafar created this revision.
jaafar added reviewers: aaron.ballman, alexfh, hokein.
jaafar added a project: clang-tools-extra.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In the process of running this check on a large codebase <https://git.skewed.de/count0/graph-tool> I found a number of limitations, and thought I would pass on my fixes for possible integration upstream:

1. Templated function call operators are not supported
2. Function object constructors are always used directly in the lambda body, even if their arguments are not captured
3. Placeholders with namespace qualifiers (`std::placeholders::_1`) are not detected
4. Lambda arguments should be forwarded to the stored function
5. Data members from other classes still get captured with `this`
6. Expressions (as opposed to variables) inside `std::ref` are not captured properly
7. Function object templates sometimes have their template arguments replaced with concrete types

This patch resolves all those issues and adds suitable unit tests.

If desired, I can separate these commits out into 7 separate diffs, but it seemed like it might be easier to evaluate them all at once.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81769

Files:
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  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: D81769.270519.patch
Type: text/x-patch
Size: 16314 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200612/b757cb82/attachment-0001.bin>


More information about the cfe-commits mailing list