summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/LazyCallGraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/LazyCallGraph.h')
-rw-r--r--include/llvm/Analysis/LazyCallGraph.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/llvm/Analysis/LazyCallGraph.h b/include/llvm/Analysis/LazyCallGraph.h
index 7f9a43aba3..df3925aba6 100644
--- a/include/llvm/Analysis/LazyCallGraph.h
+++ b/include/llvm/Analysis/LazyCallGraph.h
@@ -115,7 +115,7 @@ public:
/// the graph.
class iterator
: public iterator_adaptor_base<iterator, NodeVectorImplT::iterator,
- std::random_access_iterator_tag, Node> {
+ std::bidirectional_iterator_tag, Node> {
friend class LazyCallGraph;
friend class LazyCallGraph::Node;
@@ -124,11 +124,30 @@ public:
// Build the iterator for a specific position in a node list.
iterator(LazyCallGraph &G, NodeVectorImplT::iterator NI)
- : iterator_adaptor_base(NI), G(&G) {}
+ : iterator_adaptor_base(NI), G(&G) {
+ while (I->isNull())
+ ++I;
+ }
public:
iterator() {}
+ using iterator_adaptor_base::operator++;
+ iterator &operator++() {
+ do {
+ ++I;
+ } while (I->isNull());
+ return *this;
+ }
+
+ using iterator_adaptor_base::operator--;
+ iterator &operator--() {
+ do {
+ --I;
+ } while (I->isNull());
+ return *this;
+ }
+
reference operator*() const {
if (I->is<Node *>())
return *I->get<Node *>();