[PATCH] D69872: Improve modernize-avoid-bind to support more types of expressions

Zachary Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 16:54:38 PST 2019


zturner created this revision.
zturner added reviewers: aaron.ballman, jbcoe.

Previously modernize-avoid-bind only supported the case where the function to call was a FunctionDecl.  This patch makes it support arbitrary expressions, including functors, member functions, and combinations thereof.

This change actually *simplifies* the code rather than complicates it, because it assumes that the first argument to std::bind() is always a callable, otherwise it wouldn't even compile.  So rather than limiting ourselves to DeclRefExprs, we just accept any kind of expression for the first argument.  Fixits are still only applied in the same set of limited cases as before, although I plan to improve this in followup patches.


https://reviews.llvm.org/D69872

Files:
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-avoid-bind.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69872.227984.patch
Type: text/x-patch
Size: 3672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191106/bd4bfdfb/attachment.bin>


More information about the cfe-commits mailing list