DSNodes, unlike other GraphTraits nodes, can have null outgoing edges, and
df_iterator doesn't take this into consideration. As a workaround, the
successor iterator now handles null nodes and 'indicates' that null has
no successors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12025
91177308-0d34-0410-b5e6-
96231b3b80d8
DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator
DSNodeIterator(NodeTy *N, bool) : Node(N) { // Create end iterator
- Offset = N->getNumLinks() << DS::PointerShift;
- if (Offset == 0 && Node->getForwardNode() &&
- Node->isDeadNode()) // Model Forward link
- Offset += DS::PointerSize;
+ if (N != 0) {
+ Offset = N->getNumLinks() << DS::PointerShift;
+ if (Offset == 0 && Node->getForwardNode() &&
+ Node->isDeadNode()) // Model Forward link
+ Offset += DS::PointerSize;
+ } else {
+ Offset = 0;
+ }
}
public:
DSNodeIterator(const DSNodeHandle &NH)
DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator
DSNodeIterator(NodeTy *N, bool) : Node(N) { // Create end iterator
- Offset = N->getNumLinks() << DS::PointerShift;
- if (Offset == 0 && Node->getForwardNode() &&
- Node->isDeadNode()) // Model Forward link
- Offset += DS::PointerSize;
+ if (N != 0) {
+ Offset = N->getNumLinks() << DS::PointerShift;
+ if (Offset == 0 && Node->getForwardNode() &&
+ Node->isDeadNode()) // Model Forward link
+ Offset += DS::PointerSize;
+ } else {
+ Offset = 0;
+ }
}
public:
DSNodeIterator(const DSNodeHandle &NH)