[llvm-commits] CVS: llvm/include/Support/TarjanSCCIterator.h

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 31 14:56:01 PDT 2003


Changes in directory llvm/include/Support:

TarjanSCCIterator.h updated: 1.13 -> 1.14

---
Log message:

ELIMINATE the SCC class completely.  One less thing deriving from std::vector


---
Diffs of the changes:

Index: llvm/include/Support/TarjanSCCIterator.h
diff -u llvm/include/Support/TarjanSCCIterator.h:1.13 llvm/include/Support/TarjanSCCIterator.h:1.14
--- llvm/include/Support/TarjanSCCIterator.h:1.13	Sun Aug 31 14:51:22 2003
+++ llvm/include/Support/TarjanSCCIterator.h	Sun Aug 31 14:55:31 2003
@@ -20,36 +20,20 @@
 #include <vector>
 #include <map>
 
-//--------------------------------------------------------------------------
-// class SCC - A simple representation of an SCC in a generic Graph.
-//--------------------------------------------------------------------------
-
+//===----------------------------------------------------------------------===//
+///
+/// TarjanSCC_iterator - Enumerate the SCCs of a directed graph, in
+/// reverse topological order of the SCC DAG.
+///
 template<class GraphT, class GT = GraphTraits<GraphT> >
-struct SCC : public std::vector<typename GT::NodeType*> {
-
-  typedef typename GT::NodeType NodeType;
+class TarjanSCC_iterator
+  : public forward_iterator<std::vector<typename GT::NodeType>, ptrdiff_t> {
+  typedef typename GT::NodeType          NodeType;
   typedef typename GT::ChildIteratorType ChildItTy;
-
-  typedef std::vector<typename GT::NodeType*> super;
-  typedef typename super::iterator               iterator;
-  typedef typename super::const_iterator         const_iterator;
-  typedef typename super::reverse_iterator       reverse_iterator;
-  typedef typename super::const_reverse_iterator const_reverse_iterator;
-};
-
-//--------------------------------------------------------------------------
-// class TarjanSCC_iterator: Enumerate the SCCs of a directed graph, in
-// reverse topological order of the SCC DAG.
-//--------------------------------------------------------------------------
-
-template<class GraphT, class GT = GraphTraits<GraphT> >
-class TarjanSCC_iterator : public forward_iterator<SCC<GraphT, GT>, ptrdiff_t> {
-  typedef SCC<GraphT, GT> SccTy;
+  typedef std::vector<NodeType*> SccTy;
   typedef forward_iterator<SccTy, ptrdiff_t> super;
   typedef typename super::reference reference;
   typedef typename super::pointer pointer;
-  typedef typename GT::NodeType          NodeType;
-  typedef typename GT::ChildIteratorType ChildItTy;
 
   // The visit counters used to detect when a complete SCC is on the stack.
   // visitNum is the global counter.





More information about the llvm-commits mailing list