Add df_iterator::getPathLength and getPath as a way of getting a path from the
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 18 Aug 2010 19:00:05 +0000 (19:00 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 18 Aug 2010 19:00:05 +0000 (19:00 +0000)
entry node to the current node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111392 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/DepthFirstIterator.h

index 5f2df2a17e416cfb7e5197895d20acb1ff042c86..b9e5cbdf8c6b622100b9ac29930e8a47e7dbc615 100644 (file)
@@ -183,6 +183,16 @@ public:
   inline bool nodeVisited(NodeType *Node) const {
     return this->Visited.count(Node) != 0;
   }
+
+  /// getPathLength - Return the length of the path from the entry node to the
+  /// current node, counting both nodes.
+  unsigned getPathLength() const { return VisitStack.size(); }
+
+  /// getPath - Return the n'th node in the path from the the entry node to the
+  /// current node.
+  NodeType *getPath(unsigned n) const {
+    return VisitStack[n].first.getPointer();
+  }
 };