summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-16 01:43:11 +0000
committerChris Lattner <sabre@nondot.org>2002-10-16 01:43:11 +0000
commitff5feedf283b5321a0a16b2ee02b58af41018222 (patch)
tree34acb3d93ff46f452c2956bafe1093df5c3abf8f /include
parent641e1c252d40df3cd354ec7ed543018f31e55d96 (diff)
downloadllvm-ff5feedf283b5321a0a16b2ee02b58af41018222.tar.gz
llvm-ff5feedf283b5321a0a16b2ee02b58af41018222.tar.bz2
llvm-ff5feedf283b5321a0a16b2ee02b58af41018222.tar.xz
The second element of the iterator is really an offset, not a link
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DSGraphTraits.h18
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraphTraits.h18
2 files changed, 20 insertions, 16 deletions
diff --git a/include/llvm/Analysis/DSGraphTraits.h b/include/llvm/Analysis/DSGraphTraits.h
index 575c1e1830..d6ea1edac8 100644
--- a/include/llvm/Analysis/DSGraphTraits.h
+++ b/include/llvm/Analysis/DSGraphTraits.h
@@ -17,42 +17,44 @@
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; }
};
diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h
index 575c1e1830..d6ea1edac8 100644
--- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h
+++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h
@@ -17,42 +17,44 @@
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; }
};