Add explicit conversions between forward and reverse ilist iterators.
These follow the conversion conventions of std::reverse_iterator, which
are off-by-one: the newly-constructed "reverse" iterator dereferences to
the previous node of the one sent in. This has the benefit of
converting reverse ranges in place:
- If [I, E) is a valid range,
- then [reverse(E), reverse(I)) gives the same range in reverse order.
ilist_iterator::getReverse() is unchanged: it returns a reverse iterator
to the *same* node.
Note: we should probably add some release notes for LLVM 4.0 around the
ilist changes, and I think it makes sense to have these conversions in
(and described there). There's been some debate about whether to keep,
delete, or rename getReverse(), but for now I'd just like to get the
explicit conversions in and we can decide later whether to make
getReverse() harder to access.
Is it necessary to test all these dimensions together? (I take it this is testing all conversions to/from reverse iterators, const (reverse) iterators, and begin/end, and one off begin, so that's 2 * 2 * 2 * 3.
Are some of these in useful equivalence classes that could be reduced down? (for example the const V non-const seems pretty orthogonal to the value set (begin/end/begin+1) - actually they all seem pretty orthogonal & so perhaps 2 + 2 + 2 + 3 test cases would suffice (or maybe even less if some of the tests cross equivalence classes)?)