]> granicus.if.org Git - clang/commitdiff
[analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Feb 2011 08:42:04 +0000 (08:42 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Feb 2011 08:42:04 +0000 (08:42 +0000)
If the state is new, make sure an ExplodedNode is associated with it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126370 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/CheckerManager.h
lib/StaticAnalyzer/Checkers/ExprEngine.cpp
lib/StaticAnalyzer/Core/CheckerManager.cpp

index 57a826fba0711b66b375d2c43940687a4746a08f..276819549d1a887643305812d3f174e2a70b5143 100644 (file)
@@ -177,7 +177,6 @@ public:
                               const ExplodedNodeSet &Src,
                               SVal location, bool isLoad,
                               const Stmt *S,
-                              const GRState *state,
                               ExprEngine &Eng);
 
   /// \brief Run checkers for end of analysis.
index 7d020dacae440cedc00b990881e60e9a77daf33a..c1b1e656989b9e820c87fdc10c555d38c0f34cb9 100644 (file)
@@ -1955,14 +1955,21 @@ void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
     return;
   }
 
-  ExplodedNodeSet Src;
-  Src.Add(Pred);
   if (Checkers.empty()) {
+    ExplodedNodeSet Src;
+    if (Builder->GetState(Pred) == state) {
+      Src.Add(Pred);
+    } else {
+      // Associate this new state with an ExplodedNode.
+      Src.Add(Builder->generateNode(S, state, Pred));
+    }
     getCheckerManager().runCheckersForLocation(Dst, Src, location, isLoad, S,
-                                               state, *this);
+                                               *this);
     return;
   }
 
+  ExplodedNodeSet Src;
+  Src.Add(Pred);
   ExplodedNodeSet CheckersV1Dst;
   ExplodedNodeSet Tmp;
   ExplodedNodeSet *PrevSet = &Src;
@@ -1994,7 +2001,7 @@ void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
   }
 
   getCheckerManager().runCheckersForLocation(Dst, CheckersV1Dst, location,
-                                             isLoad, S, state, *this);
+                                             isLoad, S, *this);
 }
 
 bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, 
index 68fac6e277616da67714114a7b9ca81c7b43652d..75d331a131a823bc50a5a8eccb46d47bf1255b08 100644 (file)
@@ -177,23 +177,20 @@ namespace {
     SVal Loc;
     bool IsLoad;
     const Stmt *S;
-    const GRState *State;
     ExprEngine &Eng;
 
     CheckersTy::const_iterator checkers_begin() { return Checkers.begin(); }
     CheckersTy::const_iterator checkers_end() { return Checkers.end(); }
 
     CheckLocationContext(const CheckersTy &checkers,
-                         SVal loc, bool isLoad, const Stmt *s,
-                         const GRState *state, ExprEngine &eng)
-      : Checkers(checkers), Loc(loc), IsLoad(isLoad), S(s),
-        State(state), Eng(eng) { }
+                         SVal loc, bool isLoad, const Stmt *s, ExprEngine &eng)
+      : Checkers(checkers), Loc(loc), IsLoad(isLoad), S(s), Eng(eng) { }
 
     void runChecker(CheckerManager::CheckLocationFunc checkFn,
                     ExplodedNodeSet &Dst, ExplodedNode *Pred) {
       CheckerContext C(Dst, Eng.getBuilder(), Eng, Pred, checkFn.Checker,
                        IsLoad ? ProgramPoint::PreLoadKind :
-                       ProgramPoint::PreStoreKind, 0, S, State);
+                       ProgramPoint::PreStoreKind, 0, S);
       checkFn(Loc, IsLoad, C);
     }
   };
@@ -203,10 +200,8 @@ namespace {
 void CheckerManager::runCheckersForLocation(ExplodedNodeSet &Dst,
                                             const ExplodedNodeSet &Src,
                                             SVal location, bool isLoad,
-                                            const Stmt *S,
-                                            const GRState *state,
-                                            ExprEngine &Eng) {
-  CheckLocationContext C(LocationCheckers, location, isLoad, S, state, Eng);
+                                            const Stmt *S, ExprEngine &Eng) {
+  CheckLocationContext C(LocationCheckers, location, isLoad, S, Eng);
   expandGraphWithCheckers(C, Dst, Src);
 }