[PATCH] D133677: [llvm] Use x.empty() instead of llvm::empty(x) (NFC)

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 11:27:38 PDT 2022


kazu added a comment.

In D133677#3784137 <https://reviews.llvm.org/D133677#3784137>, @dblaikie wrote:

> hmm, I think I remember `llvm::empty` was added, maybe before llvm::iterator_range got an empty operation of its own? And in theory range-based-for loops only require begin/end, so it's sort of nice that empty could be used with that same requirement, but if, practically speaking, all our ranges have empty on them - yeah, guess this is an OK way forward.

Thank you for the review, David!

Yes, `llvm::empty` indeed predates `llvm::iterator_range::empty` by about a year.

9fd397b423ba442808957e65e3ad25a07cd203e4 added `llvm::empty` on October 31, 2018.

fdaa74217420729140f1786ea037ac445a724c8e added `llvm::iterator_range::empty` on October 7, 2019.

FWIW, the only instance of `llvm::empty(x)` in our repository that couldn't be converted to `x.empty()` was involving `std::initializer_list`, but I've already converted that to `x.size()` in a fairly natural way in af91e2b9dba6a754e62862e14629af0d240d82bc <https://reviews.llvm.org/rGaf91e2b9dba6a754e62862e14629af0d240d82bc>.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133677/new/

https://reviews.llvm.org/D133677



More information about the llvm-commits mailing list