aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-24 21:19:53 +0000
committerAnna Zaks <ganna@apple.com>2011-10-24 21:19:53 +0000
commitcca79db2ea94f71fb088f4b0f104cef8bedf8ff2 (patch)
tree42944e870dcd5954eba51ca9cb3135ba0c7bc861
parent056c4b46335a3bd2612414735d5749ee159c0165 (diff)
[analyzer] Remove the old StmtNodeBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142848 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h90
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h1
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h1
-rw-r--r--lib/StaticAnalyzer/Core/CoreEngine.cpp49
4 files changed, 6 insertions, 135 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index d981b60885..85ed21eeaa 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -41,7 +41,6 @@ class NodeBuilder;
class CoreEngine {
friend struct NodeBuilderContext;
friend class NodeBuilder;
- friend class StmtNodeBuilder;
friend class CommonNodeBuilder;
friend class GenericNodeBuilderImpl;
friend class IndirectGotoNodeBuilder;
@@ -192,8 +191,6 @@ struct NodeBuilderContext {
/// This is the simplest builder which generates nodes in the ExplodedGraph.
class NodeBuilder {
protected:
- friend class StmtNodeBuilder;
-
const NodeBuilderContext &C;
/// Specifies if the builder results have been finalized. For example, if it
@@ -333,12 +330,7 @@ public:
}
- virtual ~PureStmtNodeBuilder() {
- if (EnclosingBldr)
- for (ExplodedNodeSet::iterator I = Frontier.begin(),
- E = Frontier.end(); I != E; ++I )
- EnclosingBldr->addNodes(*I);
- }
+ virtual ~PureStmtNodeBuilder();
ExplodedNode *generateNode(const Stmt *S,
ExplodedNode *Pred,
@@ -366,86 +358,6 @@ public:
};
-class StmtNodeBuilder : public NodeBuilder {
- const unsigned Idx;
-
-public:
- bool PurgingDeadSymbols;
- bool BuildSinks;
- // TODO: Remove the flag. We should be able to use the method in the parent.
- bool hasGeneratedNode;
- ProgramPoint::Kind PointKind;
- const ProgramPointTag *Tag;
-
- void GenerateAutoTransition(ExplodedNode *N);
-
- StmtNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
- unsigned idx, const NodeBuilderContext &Ctx)
- : NodeBuilder(SrcNode, DstSet, Ctx), Idx(idx),
- PurgingDeadSymbols(false), BuildSinks(false), hasGeneratedNode(false),
- PointKind(ProgramPoint::PostStmtKind), Tag(0) {}
-
- ExplodedNode *generateNode(const Stmt *S,
- const ProgramState *St,
- ExplodedNode *Pred,
- ProgramPoint::Kind K,
- const ProgramPointTag *tag = 0,
- bool MarkAsSink = false) {
- if (PurgingDeadSymbols)
- K = ProgramPoint::PostPurgeDeadSymbolsKind;
-
- const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
- Pred->getLocationContext(), tag ? tag : Tag);
- return generateNodeImpl(L, St, Pred, MarkAsSink);
- }
-
- ExplodedNode *generateNode(const Stmt *S,
- const ProgramState *St,
- ExplodedNode *Pred,
- const ProgramPointTag *tag = 0) {
- return generateNode(S, St, Pred, PointKind, tag);
- }
-
- ExplodedNode *generateNode(const ProgramPoint &PP,
- const ProgramState *State,
- ExplodedNode *Pred) {
- return generateNodeImpl(PP, State, Pred, false);
- }
-
- /// getStmt - Return the current block-level expression associated with
- /// this builder.
- const Stmt *getStmt() const {
- const CFGStmt *CS = (*C.Block)[Idx].getAs<CFGStmt>();
- return CS ? CS->getStmt() : 0;
- }
-
- unsigned getIndex() const { return Idx; }
-
- ExplodedNode *MakeNode(ExplodedNodeSet &Dst,
- const Stmt *S,
- ExplodedNode *Pred,
- const ProgramState *St) {
- return MakeNode(Dst, S, Pred, St, PointKind);
- }
-
- ExplodedNode *MakeNode(ExplodedNodeSet &Dst,
- const Stmt *S,
- ExplodedNode *Pred,
- const ProgramState *St,
- ProgramPoint::Kind K);
-
- ExplodedNode *MakeSinkNode(ExplodedNodeSet &Dst,
- const Stmt *S,
- ExplodedNode *Pred,
- const ProgramState *St) {
- bool Tmp = BuildSinks;
- BuildSinks = true;
- ExplodedNode *N = MakeNode(Dst, S, Pred, St);
- BuildSinks = Tmp;
- return N;
- }
-};
-
class BranchNodeBuilder: public NodeBuilder {
const CFGBlock *DstT;
const CFGBlock *DstF;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
index 258fbeb952..c824ff51cc 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -54,7 +54,6 @@ class ExplodedNode : public llvm::FoldingSetNode {
friend class ExplodedGraph;
friend class CoreEngine;
friend class NodeBuilder;
- friend class StmtNodeBuilder;
friend class BranchNodeBuilder;
friend class IndirectGotoNodeBuilder;
friend class SwitchNodeBuilder;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
index a23b71ab31..8989a723e5 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -34,7 +34,6 @@ class ExplodedNode;
class ProgramState;
class ProgramStateManager;
class BlockCounter;
-class StmtNodeBuilder;
class BranchNodeBuilder;
class IndirectGotoNodeBuilder;
class SwitchNodeBuilder;
diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 809379e4ac..d6425c470b 100644
--- a/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -506,50 +506,11 @@ ExplodedNode* NodeBuilder::generateNodeImpl(const ProgramPoint &Loc,
return (IsNew ? N : 0);
}
-void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode *N) {
- assert (!N->isSink());
-
- // Check if this node entered a callee.
- if (isa<CallEnter>(N->getLocation())) {
- // Still use the index of the CallExpr. It's needed to create the callee
- // StackFrameContext.
- C.Eng.WList->enqueue(N, C.Block, Idx);
- return;
- }
-
- // Do not create extra nodes. Move to the next CFG element.
- if (isa<PostInitializer>(N->getLocation())) {
- C.Eng.WList->enqueue(N, C.Block, Idx+1);
- return;
- }
-
- PostStmt Loc(getStmt(), N->getLocationContext());
-
- if (Loc == N->getLocation()) {
- // Note: 'N' should be a fresh node because otherwise it shouldn't be
- // a member of Deferred.
- C.Eng.WList->enqueue(N, C.Block, Idx+1);
- return;
- }
-
- bool IsNew;
- ExplodedNode *Succ = C.Eng.G->getNode(Loc, N->State, &IsNew);
- Succ->addPredecessor(N, *C.Eng.G);
-
- if (IsNew)
- C.Eng.WList->enqueue(Succ, C.Block, Idx+1);
-}
-
-ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &DstSet,
- const Stmt *S,
- ExplodedNode *Pred,
- const ProgramState *St,
- ProgramPoint::Kind K) {
- ExplodedNode *N = generateNode(S, St, Pred, K, 0, BuildSinks);
- if (N && !BuildSinks){
- DstSet.Add(N);
- }
- return N;
+PureStmtNodeBuilder::~PureStmtNodeBuilder() {
+ if (EnclosingBldr)
+ for (ExplodedNodeSet::iterator I = Frontier.begin(),
+ E = Frontier.end(); I != E; ++I )
+ EnclosingBldr->addNodes(*I);
}
ExplodedNode *BranchNodeBuilder::generateNode(const ProgramState *State,