[cfe-commits] r141249 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Anna Zaks ganna at apple.com
Wed Oct 5 16:44:11 PDT 2011


Author: zaks
Date: Wed Oct  5 18:44:11 2011
New Revision: 141249

URL: http://llvm.org/viewvc/llvm-project?rev=141249&view=rev
Log:
[analyzer] Remove the last dependency on CheckerContext::getNodeBuilder() as well as the method itself.

Checkers should not directly access NodeBuilder, nodes can be created by calling the CheckerContext's generateNode() methods.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=141249&r1=141248&r2=141249&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Wed Oct  5 18:44:11 2011
@@ -78,7 +78,6 @@
   }
 
   ExplodedNodeSet &getNodeSet() { return Dst; }
-  StmtNodeBuilder &getNodeBuilder() { return B; }
   ExplodedNode *&getPredecessor() { return Pred; }
   const ProgramState *getState() { return ST ? ST : Pred->getState(); }
   const Stmt *getStmt() const { return statement; }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=141249&r1=141248&r2=141249&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Wed Oct  5 18:44:11 2011
@@ -43,22 +43,20 @@
 /// Wrapper around different kinds of node builder, so that helper functions
 /// can have a common interface.
 class GenericNodeBuilderRefCount {
-  StmtNodeBuilder *SNB;
-  const Stmt *S;
+  CheckerContext *C;
   const ProgramPointTag *tag;
   EndOfFunctionNodeBuilder *ENB;
 public:
-  GenericNodeBuilderRefCount(StmtNodeBuilder &snb, const Stmt *s,
-                     const ProgramPointTag *t)
-  : SNB(&snb), S(s), tag(t), ENB(0) {}
+  GenericNodeBuilderRefCount(CheckerContext &c,
+                             const ProgramPointTag *t)
+  : C(&c), tag(t), ENB(0) {}
 
   GenericNodeBuilderRefCount(EndOfFunctionNodeBuilder &enb)
-  : SNB(0), S(0), tag(0), ENB(&enb) {}
+  : C(0), tag(0), ENB(&enb) {}
 
   ExplodedNode *MakeNode(const ProgramState *state, ExplodedNode *Pred) {
-    if (SNB)
-      return SNB->generateNode(PostStmt(S, Pred->getLocationContext(), tag),
-                               state, Pred);
+    if (C)
+      return C->generateNode(state, Pred, tag, false);
 
     assert(ENB);
     return ENB->generateNode(state, Pred);
@@ -3110,7 +3108,7 @@
   // Update the autorelease counts.
   static SimpleProgramPointTag
          AutoreleaseTag("RetainCountChecker : Autorelease");
-  GenericNodeBuilderRefCount Bd(C.getNodeBuilder(), S, &AutoreleaseTag);
+  GenericNodeBuilderRefCount Bd(C, &AutoreleaseTag);
   llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred,
                                                    C.getEngine(), Sym, X);
 
@@ -3463,9 +3461,7 @@
 
 void RetainCountChecker::checkDeadSymbols(SymbolReaper &SymReaper,
                                           CheckerContext &C) const {
-  StmtNodeBuilder &Builder = C.getNodeBuilder();
   ExprEngine &Eng = C.getEngine();
-  const Stmt *S = C.getStmt();
   ExplodedNode *Pred = C.getPredecessor();
 
   const ProgramState *state = C.getState();
@@ -3478,7 +3474,7 @@
     if (const RefVal *T = B.lookup(Sym)){
       // Use the symbol as the tag.
       // FIXME: This might not be as unique as we would like.
-      GenericNodeBuilderRefCount Bd(Builder, S, getDeadSymbolTag(Sym));
+      GenericNodeBuilderRefCount Bd(C, getDeadSymbolTag(Sym));
       llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred, Eng,
                                                        Sym, *T);
       if (!state)
@@ -3496,7 +3492,7 @@
   }
 
   {
-    GenericNodeBuilderRefCount Bd(Builder, S, this);
+    GenericNodeBuilderRefCount Bd(C, this);
     Pred = processLeaks(state, Leaked, Bd, Eng, Pred);
   }
 





More information about the cfe-commits mailing list