]> granicus.if.org Git - clang/commitdiff
Moved GRExprEngine::NodeSet out of GRExprEngine and made it a standalone class: Explo...
authorTed Kremenek <kremenek@apple.com>
Tue, 4 Mar 2008 23:13:06 +0000 (23:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 4 Mar 2008 23:13:06 +0000 (23:13 +0000)
Made GRExprEngine::NodeSet a typedef of ExplodedNodeSet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47914 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ExplodedGraph.h
include/clang/Analysis/PathSensitive/GRExprEngine.h

index db5f692699b7a01185b8319809094fdd6086221e..a3d1bfe82e58a1bcfeb6e117cb9bdc44336cb5b7 100644 (file)
@@ -18,7 +18,7 @@
 #include "clang/Analysis/ProgramPoint.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/GraphTraits.h"
@@ -376,6 +376,38 @@ public:
   }
 };
   
+  
+template <typename NodeTy>
+class ExplodedNodeSet {
+  
+  typedef llvm::SmallPtrSet<NodeTy*,5> ImplTy;
+  ImplTy Impl;
+  
+public:
+  ExplodedNodeSet(NodeTy* N) {
+    assert (N && !static_cast<ExplodedNodeImpl*>(N)->isSink());
+    Impl.insert(N);
+  }
+  
+  ExplodedNodeSet() {}
+  
+  inline void Add(NodeTy* N) {
+    if (N && !static_cast<ExplodedNodeImpl*>(N)->isSink()) Impl.insert(N);
+  }
+  
+  typedef typename ImplTy::iterator       iterator;
+  typedef typename ImplTy::const_iterator const_iterator;
+
+  inline unsigned size() const { return Impl.size();  }
+  inline bool empty()    const { return Impl.empty(); }
+  
+  inline iterator begin() { return Impl.begin(); }
+  inline iterator end()   { return Impl.end();   }
+  
+  inline const_iterator begin() const { return Impl.begin(); }
+  inline const_iterator end()   const { return Impl.end();   }
+};  
+  
 } // end clang namespace
 
 // GraphTraits
index e310bf577fac487140909f0b00028b6ce51621d6..a8827472dfae016f364355e971d3aa83b6ebe038 100644 (file)
@@ -31,31 +31,8 @@ public:
   typedef GRBranchNodeBuilder<GRExprEngine>        BranchNodeBuilder;
   typedef GRIndirectGotoNodeBuilder<GRExprEngine>  IndirectGotoNodeBuilder;
   typedef GRSwitchNodeBuilder<GRExprEngine>        SwitchNodeBuilder;
-  
-  class NodeSet {
-    typedef llvm::SmallPtrSet<NodeTy*,10> ImplTy;
-    ImplTy Impl;
-    
-  public:
-
-    NodeSet(NodeTy* N) { assert (N && !N->isSink()); Impl.insert(N); }
-    NodeSet() {}
-    
-    inline void Add(NodeTy* N) { if (N && !N->isSink()) Impl.insert(N); }
+  typedef ExplodedNodeSet<NodeTy>                  NodeSet;
     
-    typedef ImplTy::iterator       iterator;
-    typedef ImplTy::const_iterator const_iterator;
-    
-    inline unsigned size() const { return Impl.size();  }
-    inline bool empty()    const { return Impl.empty(); }
-    
-    inline iterator begin() { return Impl.begin(); }
-    inline iterator end()   { return Impl.end();   }
-    
-    inline const_iterator begin() const { return Impl.begin(); }
-    inline const_iterator end()   const { return Impl.end();   }
-  };
-  
 protected:
   /// G - the simulation graph.
   GraphTy& G;