SIL: Avoid dereferencing sentinel nodes in ilist_iterators

The behaviour of ilist has changed in LLVM.  It is no longer permissible to
dereference the `end()` value.  Add a check to ensure that we do not
accidentally dereference the iterator.
This commit is contained in:
Francis Ricci
2016-10-05 17:10:41 -07:00
committed by Saleem Abdulrasool
parent 7d1da2af3d
commit 66dcad0d34
8 changed files with 45 additions and 37 deletions

View File

@@ -319,7 +319,7 @@ template <> struct GraphTraits<StackPromoter *>
return nodes_iterator(SP->getFunction()->end(), SP->getFunction()->end());
}
static unsigned size(GraphType SP) {
return std::distance(nodes_begin(SP), nodes_end(SP));
return std::distance(SP->getFunction()->begin(), SP->getFunction()->end());
}
};