aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-18 19:00:05 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-18 19:00:05 +0000
commit6709c7bcdacfc3cc07bc0c47d3a3f9b47c699d3a (patch)
tree3b48e9614914a750d6b429acf3e8ce223a13e00b /include/llvm/ADT
parent4ae56d725d25020106d8056c09b19319a4c49e93 (diff)
downloadexternal_llvm-6709c7bcdacfc3cc07bc0c47d3a3f9b47c699d3a.zip
external_llvm-6709c7bcdacfc3cc07bc0c47d3a3f9b47c699d3a.tar.gz
external_llvm-6709c7bcdacfc3cc07bc0c47d3a3f9b47c699d3a.tar.bz2
Add df_iterator::getPathLength and getPath as a way of getting a path from the
entry node to the current node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/DepthFirstIterator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/ADT/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h
index 5f2df2a..b9e5cbd 100644
--- a/include/llvm/ADT/DepthFirstIterator.h
+++ b/include/llvm/ADT/DepthFirstIterator.h
@@ -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();
+ }
};