[cfe-commits] r126370 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/CheckerManager.h lib/StaticAnalyzer/Checkers/ExprEngine.cpp lib/StaticAnalyzer/Core/CheckerManager.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Feb 24 00:42:04 PST 2011
Author: akirtzidis
Date: Thu Feb 24 02:42:04 2011
New Revision: 126370
URL: http://llvm.org/viewvc/llvm-project?rev=126370&view=rev
Log:
[analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible mistake.
If the state is new, make sure an ExplodedNode is associated with it.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h?rev=126370&r1=126369&r2=126370&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/CheckerManager.h Thu Feb 24 02:42:04 2011
@@ -177,7 +177,6 @@
const ExplodedNodeSet &Src,
SVal location, bool isLoad,
const Stmt *S,
- const GRState *state,
ExprEngine &Eng);
/// \brief Run checkers for end of analysis.
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp?rev=126370&r1=126369&r2=126370&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp Thu Feb 24 02:42:04 2011
@@ -1955,14 +1955,21 @@
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 @@
}
getCheckerManager().runCheckersForLocation(Dst, CheckersV1Dst, location,
- isLoad, S, state, *this);
+ isLoad, S, *this);
}
bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp?rev=126370&r1=126369&r2=126370&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CheckerManager.cpp Thu Feb 24 02:42:04 2011
@@ -177,23 +177,20 @@
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 @@
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);
}
More information about the cfe-commits
mailing list