The current ilist::reverse_iterator is a typedef from std::reverse_iteratorilist::iterator. The latter is well-designed for data structures where iterators are invalidated on changes to the container (e.g., std::vector). However, its invalidation characteristics vs. its underlying iterator are unintuitive.
I’m surfacing this on llvm-dev so it gets visibility of out-of-tree users. If you have algorithms that rely on the strange invalidation semantics of std::reverse_iterator, like the patch fixes up in lib/Transforms/Scalar/LoopRerollPass.cpp, you’ll need to update your code. Unfortunately, I couldn’t find a way to catch that at runtime.
If you’re interested in testing the patch before I commit (if you don’t trust the coverage of ninja check for your bot), let me know in the review thread and I’ll try to hold off.
"Duncan P. N. Exon Smith via llvm-dev" <llvm-dev@lists.llvm.org> writes:
The current ilist::reverse_iterator is a typedef from
std::reverse_iterator<ilist::iterator>. The latter is well-designed
for data structures where iterators are invalidated on changes to the
container (e.g., std::vector). However, its invalidation
characteristics vs. its underlying iterator are unintuitive.
I'm surfacing this on llvm-dev so it gets visibility of out-of-tree
users. If you have algorithms that rely on the strange invalidation
semantics of std::reverse_iterator, like the patch fixes up in
lib/Transforms/Scalar/LoopRerollPass.cpp, you'll need to update your
code. Unfortunately, I couldn't find a way to catch that at runtime.
This seems reasonable to me - the new model is much easier to understand
for a list-type datastructure.