diff options
-rw-r--r-- | include/llvm/Analysis/DSGraphTraits.h | 12 | ||||
-rw-r--r-- | include/llvm/Analysis/DataStructure/DSGraphTraits.h | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/include/llvm/Analysis/DSGraphTraits.h b/include/llvm/Analysis/DSGraphTraits.h index 72541b8..017d86f 100644 --- a/include/llvm/Analysis/DSGraphTraits.h +++ b/include/llvm/Analysis/DSGraphTraits.h @@ -33,10 +33,14 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> { 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) diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h index 72541b8..017d86f 100644 --- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h +++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h @@ -33,10 +33,14 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> { 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) |