[all-commits] [llvm/llvm-project] 95a355: Repair various issues with modernize-avoid-bind

Jeff Trull via All-commits all-commits at lists.llvm.org
Thu Jun 25 04:32:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 95a3550dc89a0d424d90e2c0ad30d9ecfa9422cf
      https://github.com/llvm/llvm-project/commit/95a3550dc89a0d424d90e2c0ad30d9ecfa9422cf
  Author: Jeff Trull <edaskel at att.net>
  Date:   2020-06-25 (Thu, 25 Jun 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind-permissive-parameter-list.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp

  Log Message:
  -----------
  Repair various issues with modernize-avoid-bind

In the process of running this check on a large codebase I found a
number of limitations, and thought I would pass on my fixes for
possible integration upstream:

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

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




More information about the All-commits mailing list