[llvm-commits] [llvm] r111392 - /llvm/trunk/include/llvm/ADT/DepthFirstIterator.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 18 12:00:06 PDT 2010


Author: stoklund
Date: Wed Aug 18 14:00:05 2010
New Revision: 111392

URL: http://llvm.org/viewvc/llvm-project?rev=111392&view=rev
Log:
Add df_iterator::getPathLength and getPath as a way of getting a path from the
entry node to the current node.

Modified:
    llvm/trunk/include/llvm/ADT/DepthFirstIterator.h

Modified: llvm/trunk/include/llvm/ADT/DepthFirstIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DepthFirstIterator.h?rev=111392&r1=111391&r2=111392&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DepthFirstIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/DepthFirstIterator.h Wed Aug 18 14:00:05 2010
@@ -183,6 +183,16 @@
   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();
+  }
 };
 
 





More information about the llvm-commits mailing list