llvm.org GIT mirror llvm / eae0809
SCC: Provide operator->() through iterator_facade_base Use the fancy new `iterator_facade_base` to add `scc_iterator::operator->()`. Remove other definitions where `iterator_facade_base` does the right thing. <rdar://problem/14292693> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207257 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 6 years ago
1 changed file(s) with 6 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
2424
2525 #include "llvm/ADT/DenseMap.h"
2626 #include "llvm/ADT/GraphTraits.h"
27 #include "llvm/ADT/iterator.h"
2728 #include
2829
2930 namespace llvm {
3536 /// build up a vector of nodes in a particular SCC. Note that it is a forward
3637 /// iterator and thus you cannot backtrack or re-visit nodes.
3738 template >
38 class scc_iterator
39 : public std::iterator
40 const std::vector,
41 ptrdiff_t> {
39 class scc_iterator : public iterator_facade_base<
40 scc_iterator, std::forward_iterator_tag,
41 const std::vector, ptrdiff_t> {
4242 typedef typename GT::NodeType NodeType;
4343 typedef typename GT::ChildIteratorType ChildItTy;
4444 typedef std::vector SccTy;
45 typedef std::iterator
46 const std::vector,
47 ptrdiff_t> super;
48 typedef typename super::reference reference;
49 typedef typename super::pointer pointer;
45 typedef typename scc_iterator::reference reference;
46 typedef typename scc_iterator::pointer pointer;
5047
5148 /// Element of VisitStack during DFS.
5249 struct StackElement {
114111 bool operator==(const scc_iterator &x) const {
115112 return VisitStack == x.VisitStack && CurrentSCC == x.CurrentSCC;
116113 }
117 bool operator!=(const scc_iterator &x) const { return !operator==(x); }
118114
119115 scc_iterator &operator++() {
120116 GetNextSCC();
121117 return *this;
122 }
123 scc_iterator operator++(int) {
124 scc_iterator tmp = *this;
125 ++*this;
126 return tmp;
127118 }
128119
129120 const SccTy &operator*() const {