]> granicus.if.org Git - clang/commitdiff
Added nodes_iterator to the GraphTrait for ExplodedNode<>.
authorTed Kremenek <kremenek@apple.com>
Tue, 8 Jan 2008 00:46:00 +0000 (00:46 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 8 Jan 2008 00:46:00 +0000 (00:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45730 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ExplodedNode.h

index 4ba138f8529599d22cf583756b576d2109404b44..c8828347ff0134007263f1f1d477239ce6d5b2fb 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/GraphTraits.h"
+#include "llvm/ADT/DepthFirstIterator.h"
 
 namespace clang {
   
@@ -159,8 +160,9 @@ public:
 namespace llvm {
 template<typename StateTy>
 struct GraphTraits<clang::ExplodedNode<StateTy>*> {
-  typedef clang::ExplodedNode<StateTy> NodeType;
-  typedef typename NodeType::succ_iterator ChildIteratorType;
+  typedef clang::ExplodedNode<StateTy>      NodeType;
+  typedef typename NodeType::succ_iterator  ChildIteratorType;
+  typedef llvm::df_iterator<NodeType*>      nodes_iterator;
   
   static inline NodeType* getEntryNode(NodeType* N) {
     return N;
@@ -173,12 +175,21 @@ struct GraphTraits<clang::ExplodedNode<StateTy>*> {
   static inline ChildIteratorType child_end(NodeType* N) {
     return N->succ_end();
   }
+  
+  static inline nodes_iterator nodes_begin(NodeType* N) {
+    return df_begin(N);
+  }
+  
+  static inline nodes_iterator nodes_end(NodeType* N) {
+    return df_end(N);
+  }
 };
 
 template<typename StateTy>
 struct GraphTraits<const clang::ExplodedNode<StateTy>*> {
   typedef const clang::ExplodedNode<StateTy> NodeType;
-  typedef typename NodeType::succ_iterator ChildIteratorType;
+  typedef typename NodeType::succ_iterator   ChildIteratorType;
+  typedef llvm::df_iterator<NodeType*>       nodes_iterator;
   
   static inline NodeType* getEntryNode(NodeType* N) {
     return N;
@@ -191,6 +202,14 @@ struct GraphTraits<const clang::ExplodedNode<StateTy>*> {
   static inline ChildIteratorType child_end(NodeType* N) {
     return N->succ_end();
   }
+  
+  static inline nodes_iterator nodes_begin(NodeType* N) {
+    return df_begin(N);
+  }
+  
+  static inline nodes_iterator nodes_end(NodeType* N) {
+    return df_end(N);
+  }
 };
 }
 #endif