From: Ted Kremenek Date: Tue, 8 Jan 2008 00:46:00 +0000 (+0000) Subject: Added nodes_iterator to the GraphTrait for ExplodedNode<>. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f51a20208ddb0dd4ae0495832c1872cb1efe021;p=clang Added nodes_iterator to the GraphTrait for ExplodedNode<>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45730 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/ExplodedNode.h b/include/clang/Analysis/PathSensitive/ExplodedNode.h index 4ba138f852..c8828347ff 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedNode.h +++ b/include/clang/Analysis/PathSensitive/ExplodedNode.h @@ -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 struct GraphTraits*> { - typedef clang::ExplodedNode NodeType; - typedef typename NodeType::succ_iterator ChildIteratorType; + typedef clang::ExplodedNode NodeType; + typedef typename NodeType::succ_iterator ChildIteratorType; + typedef llvm::df_iterator nodes_iterator; static inline NodeType* getEntryNode(NodeType* N) { return N; @@ -173,12 +175,21 @@ struct GraphTraits*> { 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 struct GraphTraits*> { typedef const clang::ExplodedNode NodeType; - typedef typename NodeType::succ_iterator ChildIteratorType; + typedef typename NodeType::succ_iterator ChildIteratorType; + typedef llvm::df_iterator nodes_iterator; static inline NodeType* getEntryNode(NodeType* N) { return N; @@ -191,6 +202,14 @@ struct GraphTraits*> { 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