]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove the old StmtNodeBuilder.
authorAnna Zaks <ganna@apple.com>
Mon, 24 Oct 2011 21:19:53 +0000 (21:19 +0000)
committerAnna Zaks <ganna@apple.com>
Mon, 24 Oct 2011 21:19:53 +0000 (21:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142848 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
lib/StaticAnalyzer/Core/CoreEngine.cpp

index d981b6088584db4c0ea9e242488caa8893e1d90e..85ed21eeaafcb2a6bc8e1f66caa3ef00821986af 100644 (file)
@@ -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;
index 258fbeb95249228017d02d44cf53aed6684040c5..c824ff51cc96d25a1cb92a8aab9c0f299e65ab9d 100644 (file)
@@ -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;
index a23b71ab3116790c9526c65e84998c70b3a5314e..8989a723e5b2c94bb457b0f2cdb6b8f51629f80e 100644 (file)
@@ -34,7 +34,6 @@ class ExplodedNode;
 class ProgramState;
 class ProgramStateManager;
 class BlockCounter;
-class StmtNodeBuilder;
 class BranchNodeBuilder;
 class IndirectGotoNodeBuilder;
 class SwitchNodeBuilder;
index 809379e4ac183add4cfb3b021f646aade8e40e23..d6425c470b36230d0d0011734716cb798648f8a4 100644 (file)
@@ -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,