This is an archive of the discontinued LLVM Phabricator instance.

[clangd] NFC: Migrate to LLVM STLExtras API where possible
ClosedPublic

Authored by kbobyrev on Sep 28 2018, 7:22 AM.

Details

Summary

This patch improves readability by migrating std::function(ForwardIt start, ForwardIt end, ...) to LLVM's STLExtras range-based equivalent llvm::function(RangeT &&Range, ...).

Similar change in Clang: D52576.

Diff Detail

Repository
rL LLVM

Event Timeline

kbobyrev created this revision.Sep 28 2018, 7:22 AM

Also, I'm not sure whether I should update Clang-Tidy and other tools in the scope of this patch. It makes sense to me, but I don't know whether the maintainers of these projects are happy with the change. WDYT?

sammccall accepted this revision.Sep 28 2018, 7:35 AM
This revision is now accepted and ready to land.Sep 28 2018, 7:35 AM

I think it's fine to update others too, this is a trivially-safe change and
a nice readability improvement.
No need to put everything in the same patch though.

I think it's fine to update others too, this is a trivially-safe change and
a nice readability improvement.
No need to put everything in the same patch though.

Great, thanks! I'll submit the patch once I'm home and I will make modifications in the other parts of clang-tools-extra.

Also, this making these transformations automatically might be a great idea for Clang-Tidy llvm-check (and a separate check with std::ranges later on).

kbobyrev updated this revision to Diff 168589.Oct 7 2018, 7:10 AM

Rebase on top of HEAD.

This revision was automatically updated to reflect the committed changes.