[cfe-commits] r45730 - /cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h

Ted Kremenek kremenek at apple.com
Mon Jan 7 16:46:00 PST 2008


Author: kremenek
Date: Mon Jan  7 18:46:00 2008
New Revision: 45730

URL: http://llvm.org/viewvc/llvm-project?rev=45730&view=rev
Log:
Added nodes_iterator to the GraphTrait for ExplodedNode<>.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h?rev=45730&r1=45729&r2=45730&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h Mon Jan  7 18:46:00 2008
@@ -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 @@
 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 @@
   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 @@
   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





More information about the cfe-commits mailing list