mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -17,42 +17,44 @@
|
|||||||
class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
|
class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
|
||||||
friend class DSNode;
|
friend class DSNode;
|
||||||
DSNode * const Node;
|
DSNode * const Node;
|
||||||
unsigned Link;
|
unsigned Offset;
|
||||||
|
|
||||||
typedef DSNodeIterator _Self;
|
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
|
DSNodeIterator(DSNode *N, bool) // Create end iterator
|
||||||
: Node(N), Link(N->getSize()) {
|
: Node(N), Offset(N->getSize()) {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
DSNodeIterator(const DSNodeHandle &NH)
|
||||||
|
: Node(NH.getNode()), Offset(NH.getOffset()) {}
|
||||||
|
|
||||||
bool operator==(const _Self& x) const {
|
bool operator==(const _Self& x) const {
|
||||||
return Link == x.Link;
|
return Offset == x.Offset;
|
||||||
}
|
}
|
||||||
bool operator!=(const _Self& x) const { return !operator==(x); }
|
bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||||
|
|
||||||
const _Self &operator=(const _Self &I) {
|
const _Self &operator=(const _Self &I) {
|
||||||
assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
|
assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
|
||||||
Link = I.Link;
|
Offset = I.Offset;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer operator*() const {
|
pointer operator*() const {
|
||||||
DSNodeHandle *NH = Node->getLink(Link);
|
DSNodeHandle *NH = Node->getLink(Offset);
|
||||||
return NH ? NH->getNode() : 0;
|
return NH ? NH->getNode() : 0;
|
||||||
}
|
}
|
||||||
pointer operator->() const { return operator*(); }
|
pointer operator->() const { return operator*(); }
|
||||||
|
|
||||||
_Self& operator++() { // Preincrement
|
_Self& operator++() { // Preincrement
|
||||||
++Link;
|
++Offset;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
_Self operator++(int) { // Postincrement
|
_Self operator++(int) { // Postincrement
|
||||||
_Self tmp = *this; ++*this; return tmp;
|
_Self tmp = *this; ++*this; return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getLink() const { return Link; }
|
unsigned getOffset() const { return Offset; }
|
||||||
DSNode *getNode() const { return Node; }
|
DSNode *getNode() const { return Node; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -17,42 +17,44 @@
|
|||||||
class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
|
class DSNodeIterator : public forward_iterator<DSNode, ptrdiff_t> {
|
||||||
friend class DSNode;
|
friend class DSNode;
|
||||||
DSNode * const Node;
|
DSNode * const Node;
|
||||||
unsigned Link;
|
unsigned Offset;
|
||||||
|
|
||||||
typedef DSNodeIterator _Self;
|
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
|
DSNodeIterator(DSNode *N, bool) // Create end iterator
|
||||||
: Node(N), Link(N->getSize()) {
|
: Node(N), Offset(N->getSize()) {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
DSNodeIterator(const DSNodeHandle &NH)
|
||||||
|
: Node(NH.getNode()), Offset(NH.getOffset()) {}
|
||||||
|
|
||||||
bool operator==(const _Self& x) const {
|
bool operator==(const _Self& x) const {
|
||||||
return Link == x.Link;
|
return Offset == x.Offset;
|
||||||
}
|
}
|
||||||
bool operator!=(const _Self& x) const { return !operator==(x); }
|
bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||||
|
|
||||||
const _Self &operator=(const _Self &I) {
|
const _Self &operator=(const _Self &I) {
|
||||||
assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
|
assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
|
||||||
Link = I.Link;
|
Offset = I.Offset;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer operator*() const {
|
pointer operator*() const {
|
||||||
DSNodeHandle *NH = Node->getLink(Link);
|
DSNodeHandle *NH = Node->getLink(Offset);
|
||||||
return NH ? NH->getNode() : 0;
|
return NH ? NH->getNode() : 0;
|
||||||
}
|
}
|
||||||
pointer operator->() const { return operator*(); }
|
pointer operator->() const { return operator*(); }
|
||||||
|
|
||||||
_Self& operator++() { // Preincrement
|
_Self& operator++() { // Preincrement
|
||||||
++Link;
|
++Offset;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
_Self operator++(int) { // Postincrement
|
_Self operator++(int) { // Postincrement
|
||||||
_Self tmp = *this; ++*this; return tmp;
|
_Self tmp = *this; ++*this; return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getLink() const { return Link; }
|
unsigned getOffset() const { return Offset; }
|
||||||
DSNode *getNode() const { return Node; }
|
DSNode *getNode() const { return Node; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -192,7 +192,7 @@ struct DOTGraphTraits<DSGraph*> : public DefaultDOTGraphTraits {
|
|||||||
|
|
||||||
static int getEdgeSourceLabel(DSNode *Node, DSNode::iterator I) {
|
static int getEdgeSourceLabel(DSNode *Node, DSNode::iterator I) {
|
||||||
assert(Node == I.getNode() && "Iterator not for this node!");
|
assert(Node == I.getNode() && "Iterator not for this node!");
|
||||||
return Node->getMergeMapLabel(I.getLink());
|
return Node->getMergeMapLabel(I.getOffset());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user