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

Zhongxing Xu xuzhongxing at gmail.com
Thu Jul 1 00:11:00 PDT 2010


Author: zhongxingxu
Date: Thu Jul  1 02:10:59 2010
New Revision: 107388

URL: http://llvm.org/viewvc/llvm-project?rev=107388&view=rev
Log:
ExplodedGraph never uses ASTContext, remove it.

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/ExplodedGraph.h
    cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
    cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
    cfe/trunk/lib/Checker/BugReporter.cpp
    cfe/trunk/lib/Checker/GRExprEngine.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/ExplodedGraph.h?rev=107388&r1=107387&r2=107388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/ExplodedGraph.h Thu Jul  1 02:10:59 2010
@@ -36,7 +36,6 @@
 
 class GRState;
 class CFG;
-class ASTContext;
 class ExplodedGraph;
 
 //===----------------------------------------------------------------------===//
@@ -240,9 +239,6 @@
   /// 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 @@
                         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 @@
     return V;
   }
 
-  ExplodedGraph(ASTContext& ctx) : Ctx(ctx), NumNodes(0) {}
+  ExplodedGraph() : NumNodes(0) {}
 
   ~ExplodedGraph() {}
 
@@ -318,8 +314,6 @@
   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*>

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h?rev=107388&r1=107387&r2=107388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h Thu Jul  1 02:10:59 2010
@@ -109,8 +109,8 @@
 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 @@
   /// 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) {}
 

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h?rev=107388&r1=107387&r2=107388&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h Thu Jul  1 02:10:59 2010
@@ -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 @@
   }
 
   /// 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; }
 

Modified: cfe/trunk/lib/Checker/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BugReporter.cpp?rev=107388&r1=107387&r2=107388&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BugReporter.cpp (original)
+++ cfe/trunk/lib/Checker/BugReporter.cpp Thu Jul  1 02:10:59 2010
@@ -1403,7 +1403,7 @@
 
   // 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

Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=107388&r1=107387&r2=107388&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Thu Jul  1 02:10:59 2010
@@ -379,10 +379,10 @@
 
 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 @@
     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);





More information about the cfe-commits mailing list