[PATCH] D103900: [llvm] Add enum iteration to Sequence

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 09:11:29 PDT 2021


gchatelet added a comment.

Please take another look @Quuxplusone .



================
Comment at: llvm/include/llvm/ADT/Sequence.h:186
+  auto rbegin() const { return const_reverse_iterator(*--end()); }
+  auto rend() const { return const_reverse_iterator(*--begin()); }
 
----------------
Quuxplusone wrote:
> I've just noticed that this is unidiomatic: on normal iterators, `--begin()` would be UB. (`std::reverse_iterator` always stores one-past-where-it's-"pointing"-to, for this reason.) I guess it's OK here, but if you've got the time, maybe think about some way to avoid the hiccup here.
I've added a note as I couldn't find a better implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103900



More information about the llvm-commits mailing list