[cfe-commits] r47914 - in /cfe/trunk/include/clang/Analysis/PathSensitive: ExplodedGraph.h GRExprEngine.h
Ted Kremenek
kremenek at apple.com
Tue Mar 4 15:13:06 PST 2008
Author: kremenek
Date: Tue Mar 4 17:13:06 2008
New Revision: 47914
URL: http://llvm.org/viewvc/llvm-project?rev=47914&view=rev
Log:
Moved GRExprEngine::NodeSet out of GRExprEngine and made it a standalone class: ExplodedNodeSet.
Made GRExprEngine::NodeSet a typedef of ExplodedNodeSet.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=47914&r1=47913&r2=47914&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Tue Mar 4 17:13:06 2008
@@ -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 @@
}
};
+
+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
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=47914&r1=47913&r2=47914&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Tue Mar 4 17:13:06 2008
@@ -31,31 +31,8 @@
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;
More information about the cfe-commits
mailing list