[llvm] Make Sequence reverse-iterable

Authored by gchatelet on Jun 10 2021, 4:15 AM.


[llvm] Make Sequence reverse-iterable

This is a roll forward of D102679.
This patch simplifies the implementation of Sequence and makes it compatible with llvm::reverse.
It exposes the reverse iterators through rbegin/rend which prevents a dangling reference in std::reverse_iterator::operator++().

Note: Compared to D102679, this patch introduces a asSmallVector() member function and fixes compilation issue with GCC 5.

Differential Revision: https://reviews.llvm.org/D103948