[cfe-commits] r142848 - in /cfe/trunk: 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

Anna Zaks ganna at apple.com
Mon Oct 24 14:19:53 PDT 2011


Author: zaks
Date: Mon Oct 24 16:19:53 2011
New Revision: 142848

URL: http://llvm.org/viewvc/llvm-project?rev=142848&view=rev
Log:
[analyzer] Remove the old StmtNodeBuilder.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
    cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h?rev=142848&r1=142847&r2=142848&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h Mon Oct 24 16:19:53 2011
@@ -41,7 +41,6 @@
 class CoreEngine {
   friend struct NodeBuilderContext;
   friend class NodeBuilder;
-  friend class StmtNodeBuilder;
   friend class CommonNodeBuilder;
   friend class GenericNodeBuilderImpl;
   friend class IndirectGotoNodeBuilder;
@@ -192,8 +191,6 @@
 /// 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 @@
 
   }
 
-  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 @@
 
 };
 
-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;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=142848&r1=142847&r2=142848&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h Mon Oct 24 16:19:53 2011
@@ -54,7 +54,6 @@
   friend class ExplodedGraph;
   friend class CoreEngine;
   friend class NodeBuilder;
-  friend class StmtNodeBuilder;
   friend class BranchNodeBuilder;
   friend class IndirectGotoNodeBuilder;
   friend class SwitchNodeBuilder;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h?rev=142848&r1=142847&r2=142848&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h Mon Oct 24 16:19:53 2011
@@ -34,7 +34,6 @@
 class ProgramState;
 class ProgramStateManager;
 class BlockCounter;
-class StmtNodeBuilder;
 class BranchNodeBuilder;
 class IndirectGotoNodeBuilder;
 class SwitchNodeBuilder;

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=142848&r1=142847&r2=142848&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Mon Oct 24 16:19:53 2011
@@ -506,50 +506,11 @@
   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,





More information about the cfe-commits mailing list