The second element of the iterator is really an offset, not a link
authorChris Lattner <sabre@nondot.org>
Wed, 16 Oct 2002 01:43:11 +0000 (01:43 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Oct 2002 01:43:11 +0000 (01:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4196 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DSGraphTraits.h
include/llvm/Analysis/DataStructure/DSGraphTraits.h
lib/Analysis/DataStructure/Printer.cpp

index 575c1e183061126ce55a5dc4f7a5e684c272d424..d6ea1edac8c756ac6697f2782f067f9b038d80e8 100644 (file)
 class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
   friend class DSNode;
   DSNode * const Node;
-  unsigned Link;
+  unsigned Offset;
   
   typedef DSNodeIterator _Self;
 
-  DSNodeIterator(DSNode *N) : Node(N), Link(0) {}   // begin iterator
+  DSNodeIterator(DSNode *N) : Node(N), Offset(0) {}   // begin iterator
   DSNodeIterator(DSNode *N, bool)       // Create end iterator
-    : Node(N), Link(N->getSize()) {
+    : Node(N), Offset(N->getSize()) {
   }
 public:
+  DSNodeIterator(const DSNodeHandle &NH)
+    : Node(NH.getNode()), Offset(NH.getOffset()) {}
 
   bool operator==(const _Self& x) const {
-    return Link == x.Link;
+    return Offset == x.Offset;
   }
   bool operator!=(const _Self& x) const { return !operator==(x); }
 
   const _Self &operator=(const _Self &I) {
     assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
-    Link = I.Link;
+    Offset = I.Offset;
     return *this;
   }
   
   pointer operator*() const {
-    DSNodeHandle *NH = Node->getLink(Link);
+    DSNodeHandle *NH = Node->getLink(Offset);
     return NH ? NH->getNode() : 0;
   }
   pointer operator->() const { return operator*(); }
   
   _Self& operator++() {                // Preincrement
-    ++Link;
+    ++Offset;
     return *this;
   }
   _Self operator++(int) { // Postincrement
     _Self tmp = *this; ++*this; return tmp; 
   }
 
-  unsigned getLink() const { return Link; }
+  unsigned getOffset() const { return Offset; }
   DSNode *getNode() const { return Node; }
 };
 
index 575c1e183061126ce55a5dc4f7a5e684c272d424..d6ea1edac8c756ac6697f2782f067f9b038d80e8 100644 (file)
 class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
   friend class DSNode;
   DSNode * const Node;
-  unsigned Link;
+  unsigned Offset;
   
   typedef DSNodeIterator _Self;
 
-  DSNodeIterator(DSNode *N) : Node(N), Link(0) {}   // begin iterator
+  DSNodeIterator(DSNode *N) : Node(N), Offset(0) {}   // begin iterator
   DSNodeIterator(DSNode *N, bool)       // Create end iterator
-    : Node(N), Link(N->getSize()) {
+    : Node(N), Offset(N->getSize()) {
   }
 public:
+  DSNodeIterator(const DSNodeHandle &NH)
+    : Node(NH.getNode()), Offset(NH.getOffset()) {}
 
   bool operator==(const _Self& x) const {
-    return Link == x.Link;
+    return Offset == x.Offset;
   }
   bool operator!=(const _Self& x) const { return !operator==(x); }
 
   const _Self &operator=(const _Self &I) {
     assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
-    Link = I.Link;
+    Offset = I.Offset;
     return *this;
   }
   
   pointer operator*() const {
-    DSNodeHandle *NH = Node->getLink(Link);
+    DSNodeHandle *NH = Node->getLink(Offset);
     return NH ? NH->getNode() : 0;
   }
   pointer operator->() const { return operator*(); }
   
   _Self& operator++() {                // Preincrement
-    ++Link;
+    ++Offset;
     return *this;
   }
   _Self operator++(int) { // Postincrement
     _Self tmp = *this; ++*this; return tmp; 
   }
 
-  unsigned getLink() const { return Link; }
+  unsigned getOffset() const { return Offset; }
   DSNode *getNode() const { return Node; }
 };
 
index 87ba971211931a551fed8a6a622798eb82425108..d8e755b42bbf6e0e72ba440dc1213f16d38bdbcf 100644 (file)
@@ -192,7 +192,7 @@ struct DOTGraphTraits<DSGraph*> : public DefaultDOTGraphTraits {
   
   static int getEdgeSourceLabel(DSNode *Node, DSNode::iterator I) {
     assert(Node == I.getNode() && "Iterator not for this node!");
-    return Node->getMergeMapLabel(I.getLink());
+    return Node->getMergeMapLabel(I.getOffset());
   }
 };