mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
master-next: Change TransformIterator to work with bidirectional iterators.
The custom DFS implementation for dominators in LLVM r307727 uses a reverse iterator and so fails to build if SILBasicBlocks do not support that.
This commit is contained in:
@@ -392,7 +392,7 @@ makeFilterRange(Range range, Predicate pred) {
|
||||
return FilterRange<Range, Predicate>(range, pred);
|
||||
}
|
||||
|
||||
/// An iterator that transforms the result of an underlying forward
|
||||
/// An iterator that transforms the result of an underlying bidirectional
|
||||
/// iterator with a given operation.
|
||||
///
|
||||
/// \tparam Iterator the underlying iterator.
|
||||
@@ -411,7 +411,7 @@ class TransformIterator {
|
||||
using OpTraits = function_traits<Operation>;
|
||||
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = typename OpTraits::result_type;
|
||||
using reference = value_type;
|
||||
using pointer = void; // FIXME: Should provide a pointer proxy.
|
||||
@@ -438,6 +438,17 @@ public:
|
||||
return old;
|
||||
}
|
||||
|
||||
TransformIterator &operator--() {
|
||||
--Current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TransformIterator operator--(int) {
|
||||
TransformIterator old = *this;
|
||||
--*this;
|
||||
return old;
|
||||
}
|
||||
|
||||
friend bool operator==(TransformIterator lhs, TransformIterator rhs) {
|
||||
return lhs.Current == rhs.Current;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user