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

Ted Kremenek kremenek at apple.com
Mon Jan 7 16:26:06 PST 2008


Author: kremenek
Date: Mon Jan  7 18:26:05 2008
New Revision: 45729

URL: http://llvm.org/viewvc/llvm-project?rev=45729&view=rev
Log:
Added GraphTraits<> partial specializations for ExplodedNode<> classes.

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=45729&r1=45728&r2=45729&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedNode.h Mon Jan  7 18:26:05 2008
@@ -19,6 +19,7 @@
 #include "clang/Analysis/ProgramEdge.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/FoldingSet.h"
+#include "llvm/ADT/GraphTraits.h"
 
 namespace clang {
   
@@ -153,4 +154,43 @@
   
 } // end namespace clang
 
+// GraphTraits for ExplodedNodes.
+
+namespace llvm {
+template<typename StateTy>
+struct GraphTraits<clang::ExplodedNode<StateTy>*> {
+  typedef clang::ExplodedNode<StateTy> NodeType;
+  typedef typename NodeType::succ_iterator ChildIteratorType;
+  
+  static inline NodeType* getEntryNode(NodeType* N) {
+    return N;
+  }
+  
+  static inline ChildIteratorType child_begin(NodeType* N) {
+    return N->succ_begin();
+  }
+  
+  static inline ChildIteratorType child_end(NodeType* N) {
+    return N->succ_end();
+  }
+};
+
+template<typename StateTy>
+struct GraphTraits<const clang::ExplodedNode<StateTy>*> {
+  typedef const clang::ExplodedNode<StateTy> NodeType;
+  typedef typename NodeType::succ_iterator ChildIteratorType;
+  
+  static inline NodeType* getEntryNode(NodeType* N) {
+    return N;
+  }
+  
+  static inline ChildIteratorType child_begin(NodeType* N) {
+    return N->succ_begin();
+  }
+  
+  static inline ChildIteratorType child_end(NodeType* N) {
+    return N->succ_end();
+  }
+};
+}
 #endif





More information about the cfe-commits mailing list