[llvm] r207270 - SCC: Use the reference typedef

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Apr 25 13:52:08 PDT 2014


Author: dexonsmith
Date: Fri Apr 25 15:52:08 2014
New Revision: 207270

URL: http://llvm.org/viewvc/llvm-project?rev=207270&view=rev
Log:
SCC: Use the reference typedef

Actually use the `reference` typedef, and remove the private
redefinition of `pointer` since it has no users.

Using `reference` exposes a problem with r207257, which specified the
wrong `value_type` to `iterator_facade_base` (fixed that too).

Modified:
    llvm/trunk/include/llvm/ADT/SCCIterator.h

Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=207270&r1=207269&r2=207270&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SCCIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/SCCIterator.h Fri Apr 25 15:52:08 2014
@@ -37,14 +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 GraphT, class GT = GraphTraits<GraphT>>
-class scc_iterator : public iterator_facade_base<
-                         scc_iterator<GraphT, GT>, std::forward_iterator_tag,
-                         const std::vector<typename GT::NodeType>, ptrdiff_t> {
+class scc_iterator
+    : public iterator_facade_base<
+          scc_iterator<GraphT, GT>, std::forward_iterator_tag,
+          const std::vector<typename GT::NodeType *>, ptrdiff_t> {
   typedef typename GT::NodeType NodeType;
   typedef typename GT::ChildIteratorType ChildItTy;
   typedef std::vector<NodeType *> SccTy;
   typedef typename scc_iterator::reference reference;
-  typedef typename scc_iterator::pointer pointer;
 
   /// Element of VisitStack during DFS.
   struct StackElement {
@@ -118,7 +118,7 @@ public:
     return *this;
   }
 
-  const SccTy &operator*() const {
+  reference operator*() const {
     assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
     return CurrentSCC;
   }





More information about the llvm-commits mailing list