summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2014-03-06 02:02:43 +0000
committerOwen Anderson <resistor@mac.com>2014-03-06 02:02:43 +0000
commitaa3d8b2d6cffba317e5b2fac86c741255fed0187 (patch)
tree8d71360d28a1ee0387509571c9465b5e34f86a53
parent907423f7db7b9537cc3101398fc981f140fef348 (diff)
downloadllvm-aa3d8b2d6cffba317e5b2fac86c741255fed0187.tar.gz
llvm-aa3d8b2d6cffba317e5b2fac86c741255fed0187.tar.bz2
llvm-aa3d8b2d6cffba317e5b2fac86c741255fed0187.tar.xz
Change the tag on this iterator to bidir and implement enough operators to make it true.
It ought to be possible to make this truly random access if anyone cares enough. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203060 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/IR/Metadata.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h
index 9992e5cbde..9b044a3729 100644
--- a/include/llvm/IR/Metadata.h
+++ b/include/llvm/IR/Metadata.h
@@ -210,7 +210,7 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
template<class T1, class T2>
class op_iterator_impl :
- public std::iterator<std::random_access_iterator_tag, T2> {
+ public std::iterator<std::bidirectional_iterator_tag, T2> {
const NamedMDNode *Node;
unsigned Idx;
op_iterator_impl(const NamedMDNode *N, unsigned i) : Node(N), Idx(i) { }
@@ -232,6 +232,16 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
operator++();
return tmp;
}
+ op_iterator_impl &operator--() {
+ --Idx;
+ return *this;
+ }
+ op_iterator_impl operator--(int) {
+ op_iterator_impl tmp(*this);
+ operator--();
+ return tmp;
+ }
+
op_iterator_impl &operator=(const op_iterator_impl &o) {
Node = o.Node;
Idx = o.Idx;