This is an archive of the discontinued LLVM Phabricator instance.

Improve modernize-avoid-bind to support more types of expressions
AbandonedPublic

Authored by zturner on Nov 5 2019, 4:50 PM.

Details

Summary

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.

Diff Detail

Event Timeline

zturner created this revision.Nov 5 2019, 4:50 PM
zturner updated this revision to Diff 228093.Nov 6 2019, 10:12 AM

Minor cleanup -- moved isFixitSupported logic to its own function.

zturner abandoned this revision.Nov 17 2019, 6:28 PM

I have a more comprehensive version of this patch that I'll upload separately.