From: Duncan P. N. Exon Smith Date: Fri, 25 Apr 2014 18:43:41 +0000 (+0000) Subject: SCC: Provide operator->() through iterator_facade_base X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=eae0809a6067bb0575854a10d1e1e8ca0b6ef568;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207257 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h index 4732ef5e91f..79f9ac40633 100644 --- a/include/llvm/ADT/SCCIterator.h +++ b/include/llvm/ADT/SCCIterator.h @@ -25,6 +25,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/GraphTraits.h" +#include "llvm/ADT/iterator.h" #include namespace llvm { @@ -36,18 +37,14 @@ namespace llvm { /// build up a vector of nodes in a particular SCC. Note that it is a forward /// iterator and thus you cannot backtrack or re-visit nodes. template > -class scc_iterator - : public std::iterator, - ptrdiff_t> { +class scc_iterator : public iterator_facade_base< + scc_iterator, std::forward_iterator_tag, + const std::vector, ptrdiff_t> { typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; typedef std::vector SccTy; - typedef std::iterator, - ptrdiff_t> super; - typedef typename super::reference reference; - typedef typename super::pointer pointer; + typedef typename scc_iterator::reference reference; + typedef typename scc_iterator::pointer pointer; /// Element of VisitStack during DFS. struct StackElement { @@ -115,17 +112,11 @@ public: bool operator==(const scc_iterator &x) const { return VisitStack == x.VisitStack && CurrentSCC == x.CurrentSCC; } - bool operator!=(const scc_iterator &x) const { return !operator==(x); } scc_iterator &operator++() { GetNextSCC(); return *this; } - scc_iterator operator++(int) { - scc_iterator tmp = *this; - ++*this; - return tmp; - } const SccTy &operator*() const { assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");