]> granicus.if.org Git - clang/commitdiff
ExplodedGraph never uses ASTContext, remove it.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 1 Jul 2010 07:10:59 +0000 (07:10 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 1 Jul 2010 07:10:59 +0000 (07:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107388 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/ExplodedGraph.h
include/clang/Checker/PathSensitive/GRCoreEngine.h
include/clang/Checker/PathSensitive/GRExprEngine.h
lib/Checker/BugReporter.cpp
lib/Checker/GRExprEngine.cpp

index c09c89312e10624fedad2f3749f7bfa0cdcb5b0b..c875a2308ba387cb382855a248af2b566b642574 100644 (file)
@@ -36,7 +36,6 @@ namespace clang {
 
 class GRState;
 class CFG;
-class ASTContext;
 class ExplodedGraph;
 
 //===----------------------------------------------------------------------===//
@@ -240,9 +239,6 @@ protected:
   /// and successor groups.
   BumpVectorContext BVC;
 
-  /// Ctx - The ASTContext used to "interpret" CodeDecl.
-  ASTContext& Ctx;
-
   /// NumNodes - The number of nodes in the graph.
   unsigned NumNodes;
 
@@ -256,7 +252,7 @@ public:
                         bool* IsNew = 0);
 
   ExplodedGraph* MakeEmptyGraph() const {
-    return new ExplodedGraph(Ctx);
+    return new ExplodedGraph();
   }
 
   /// addRoot - Add an untyped node to the set of roots.
@@ -271,7 +267,7 @@ public:
     return V;
   }
 
-  ExplodedGraph(ASTContext& ctx) : Ctx(ctx), NumNodes(0) {}
+  ExplodedGraph() : NumNodes(0) {}
 
   ~ExplodedGraph() {}
 
@@ -318,8 +314,6 @@ public:
   llvm::BumpPtrAllocator & getAllocator() { return BVC.getAllocator(); }
   BumpVectorContext &getNodeAllocator() { return BVC; }
 
-  ASTContext& getContext() { return Ctx; }
-
   typedef llvm::DenseMap<const ExplodedNode*, ExplodedNode*> NodeMap;
 
   std::pair<ExplodedGraph*, InterExplodedGraphMap*>
index 936f18b97b5c910c44d1756f361230e4d27bc804..7f101dca97e5da8f26310c7c72ac5bce7ec264a9 100644 (file)
@@ -109,8 +109,8 @@ private:
 public:
   /// Construct a GRCoreEngine object to analyze the provided CFG using
   ///  a DFS exploration of the exploded graph.
-  GRCoreEngine(ASTContext& ctx, GRSubEngine& subengine)
-    : SubEngine(subengine), G(new ExplodedGraph(ctx)),
+  GRCoreEngine(GRSubEngine& subengine)
+    : SubEngine(subengine), G(new ExplodedGraph()),
       WList(GRWorkList::MakeBFS()),
       BCounterFactory(G->getAllocator()),
       BlockAborted(false) {}
@@ -118,8 +118,8 @@ public:
   /// Construct a GRCoreEngine object to analyze the provided CFG and to
   ///  use the provided worklist object to execute the worklist algorithm.
   ///  The GRCoreEngine object assumes ownership of 'wlist'.
-  GRCoreEngine(ASTContext& ctx, GRWorkList* wlist, GRSubEngine& subengine)
-    : SubEngine(subengine), G(new ExplodedGraph(ctx)), WList(wlist),
+  GRCoreEngine(GRWorkList* wlist, GRSubEngine& subengine)
+    : SubEngine(subengine), G(new ExplodedGraph()), WList(wlist),
       BCounterFactory(G->getAllocator()),
       BlockAborted(false) {}
 
index a302ea4eb0184848d4ff438e1539353dc7d34346..8eaf3f4a97d7042f29be0959dcb525ccad23d153 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_GREXPRENGINE
 #define LLVM_CLANG_ANALYSIS_GREXPRENGINE
 
+#include "clang/Checker/PathSensitive/AnalysisManager.h"
 #include "clang/Checker/PathSensitive/GRSubEngine.h"
 #include "clang/Checker/PathSensitive/GRCoreEngine.h"
 #include "clang/Checker/PathSensitive/GRState.h"
@@ -117,7 +118,7 @@ public:
   }
 
   /// getContext - Return the ASTContext associated with this analysis.
-  ASTContext& getContext() const { return G.getContext(); }
+  ASTContext& getContext() const { return AMgr.getASTContext(); }
 
   AnalysisManager &getAnalysisManager() const { return AMgr; }
 
index 3bcc03f4f29c7d60f94f5000525f711ab379c303..560953f358ac54e2802816f7ae006e94aa6cdf3a 100644 (file)
@@ -1403,7 +1403,7 @@ MakeReportGraph(const ExplodedGraph* G,
 
   // Create a new (third!) graph with a single path.  This is the graph
   // that will be returned to the caller.
-  ExplodedGraph *GNew = new ExplodedGraph(GTrim->getContext());
+  ExplodedGraph *GNew = new ExplodedGraph();
 
   // Sometimes the trimmed graph can contain a cycle.  Perform a reverse BFS
   // to the root node, and then construct a new graph that contains only
index 7b4bfb9b028c54cc6aa9212437f1220cef05337d..723106e1dfa18c3a183cbf2a64b1a411bf1aa9dd 100644 (file)
@@ -379,10 +379,10 @@ static void RegisterInternalChecks(GRExprEngine &Eng) {
 
 GRExprEngine::GRExprEngine(AnalysisManager &mgr, GRTransferFuncs *tf)
   : AMgr(mgr),
-    CoreEngine(mgr.getASTContext(), *this),
+    CoreEngine(*this),
     G(CoreEngine.getGraph()),
     Builder(NULL),
-    StateMgr(G.getContext(), mgr.getStoreManagerCreator(),
+    StateMgr(getContext(), mgr.getStoreManagerCreator(),
              mgr.getConstraintManagerCreator(), G.getAllocator(),
              *this),
     SymMgr(StateMgr.getSymbolManager()),
@@ -390,7 +390,7 @@ GRExprEngine::GRExprEngine(AnalysisManager &mgr, GRTransferFuncs *tf)
     SVator(ValMgr.getSValuator()),
     CurrentStmt(NULL),
     NSExceptionII(NULL), NSExceptionInstanceRaiseSelectors(NULL),
-    RaiseSel(GetNullarySelector("raise", G.getContext())),
+    RaiseSel(GetNullarySelector("raise", getContext())),
     BR(mgr, *this), TF(tf) {
   // Register internal checks.
   RegisterInternalChecks(*this);