[ADT] Fix DepthFirstIterator's std::iterator base to have normal typedefs

Summary: This is similiar to r278752, where I found that the std::iterator<...> base can be normal.

Reviewers: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 278753
This commit is contained in:
Tim Shen 2016-08-15 22:07:30 +00:00
parent e0793db41d
commit 75ca2ac329
2 changed files with 6 additions and 10 deletions

View File

@ -64,13 +64,9 @@ template <class GraphT,
llvm::SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>, llvm::SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>,
bool ExtStorage = false, class GT = GraphTraits<GraphT>> bool ExtStorage = false, class GT = GraphTraits<GraphT>>
class df_iterator class df_iterator
: public std::iterator<std::forward_iterator_tag, typename GT::NodeRef, : public std::iterator<std::forward_iterator_tag, typename GT::NodeRef>,
ptrdiff_t, typename GT::NodeRef,
typename GT::NodeRef>,
public df_iterator_storage<SetType, ExtStorage> { public df_iterator_storage<SetType, ExtStorage> {
typedef std::iterator<std::forward_iterator_tag, typename GT::NodeRef, typedef std::iterator<std::forward_iterator_tag, typename GT::NodeRef> super;
ptrdiff_t, typename GT::NodeRef, typename GT::NodeRef>
super;
typedef typename GT::NodeRef NodeRef; typedef typename GT::NodeRef NodeRef;
typedef typename GT::ChildIteratorType ChildItTy; typedef typename GT::ChildIteratorType ChildItTy;
@ -145,7 +141,7 @@ public:
} }
bool operator!=(const df_iterator &x) const { return !(*this == x); } bool operator!=(const df_iterator &x) const { return !(*this == x); }
NodeRef operator*() const { return VisitStack.back().first; } const NodeRef &operator*() const { return VisitStack.back().first; }
// This is a nonstandard operator-> that dereferences the pointer an extra // This is a nonstandard operator-> that dereferences the pointer an extra
// time... so that you can actually call methods ON the Node, because // time... so that you can actually call methods ON the Node, because

View File

@ -568,10 +568,10 @@ public:
public: public:
typedef block_iterator_wrapper<IsConst> Self; typedef block_iterator_wrapper<IsConst> Self;
typedef typename super::pointer pointer; typedef typename super::value_type value_type;
// Construct the begin iterator. // Construct the begin iterator.
block_iterator_wrapper(pointer Entry, pointer Exit) block_iterator_wrapper(value_type Entry, value_type Exit)
: super(df_begin(Entry)) { : super(df_begin(Entry)) {
// Mark the exit of the region as visited, so that the children of the // Mark the exit of the region as visited, so that the children of the
// exit and the exit itself, i.e. the block outside the region will never // exit and the exit itself, i.e. the block outside the region will never
@ -580,7 +580,7 @@ public:
} }
// Construct the end iterator. // Construct the end iterator.
block_iterator_wrapper() : super(df_end<pointer>((BlockT *)nullptr)) {} block_iterator_wrapper() : super(df_end<value_type>((BlockT *)nullptr)) {}
/*implicit*/ block_iterator_wrapper(super I) : super(I) {} /*implicit*/ block_iterator_wrapper(super I) : super(I) {}