forked from OSchip/llvm-project
[analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible mistake.
If the state is new, make sure an ExplodedNode is associated with it. llvm-svn: 126370
This commit is contained in:
parent
7bc0141043
commit
8f38c3843d
|
@ -177,7 +177,6 @@ public:
|
||||||
const ExplodedNodeSet &Src,
|
const ExplodedNodeSet &Src,
|
||||||
SVal location, bool isLoad,
|
SVal location, bool isLoad,
|
||||||
const Stmt *S,
|
const Stmt *S,
|
||||||
const GRState *state,
|
|
||||||
ExprEngine &Eng);
|
ExprEngine &Eng);
|
||||||
|
|
||||||
/// \brief Run checkers for end of analysis.
|
/// \brief Run checkers for end of analysis.
|
||||||
|
|
|
@ -1955,14 +1955,21 @@ void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExplodedNodeSet Src;
|
|
||||||
Src.Add(Pred);
|
|
||||||
if (Checkers.empty()) {
|
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,
|
getCheckerManager().runCheckersForLocation(Dst, Src, location, isLoad, S,
|
||||||
state, *this);
|
*this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExplodedNodeSet Src;
|
||||||
|
Src.Add(Pred);
|
||||||
ExplodedNodeSet CheckersV1Dst;
|
ExplodedNodeSet CheckersV1Dst;
|
||||||
ExplodedNodeSet Tmp;
|
ExplodedNodeSet Tmp;
|
||||||
ExplodedNodeSet *PrevSet = &Src;
|
ExplodedNodeSet *PrevSet = &Src;
|
||||||
|
@ -1994,7 +2001,7 @@ void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
|
||||||
}
|
}
|
||||||
|
|
||||||
getCheckerManager().runCheckersForLocation(Dst, CheckersV1Dst, location,
|
getCheckerManager().runCheckersForLocation(Dst, CheckersV1Dst, location,
|
||||||
isLoad, S, state, *this);
|
isLoad, S, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
|
bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
|
||||||
|
|
|
@ -177,23 +177,20 @@ namespace {
|
||||||
SVal Loc;
|
SVal Loc;
|
||||||
bool IsLoad;
|
bool IsLoad;
|
||||||
const Stmt *S;
|
const Stmt *S;
|
||||||
const GRState *State;
|
|
||||||
ExprEngine &Eng;
|
ExprEngine &Eng;
|
||||||
|
|
||||||
CheckersTy::const_iterator checkers_begin() { return Checkers.begin(); }
|
CheckersTy::const_iterator checkers_begin() { return Checkers.begin(); }
|
||||||
CheckersTy::const_iterator checkers_end() { return Checkers.end(); }
|
CheckersTy::const_iterator checkers_end() { return Checkers.end(); }
|
||||||
|
|
||||||
CheckLocationContext(const CheckersTy &checkers,
|
CheckLocationContext(const CheckersTy &checkers,
|
||||||
SVal loc, bool isLoad, const Stmt *s,
|
SVal loc, bool isLoad, const Stmt *s, ExprEngine &eng)
|
||||||
const GRState *state, ExprEngine &eng)
|
: Checkers(checkers), Loc(loc), IsLoad(isLoad), S(s), Eng(eng) { }
|
||||||
: Checkers(checkers), Loc(loc), IsLoad(isLoad), S(s),
|
|
||||||
State(state), Eng(eng) { }
|
|
||||||
|
|
||||||
void runChecker(CheckerManager::CheckLocationFunc checkFn,
|
void runChecker(CheckerManager::CheckLocationFunc checkFn,
|
||||||
ExplodedNodeSet &Dst, ExplodedNode *Pred) {
|
ExplodedNodeSet &Dst, ExplodedNode *Pred) {
|
||||||
CheckerContext C(Dst, Eng.getBuilder(), Eng, Pred, checkFn.Checker,
|
CheckerContext C(Dst, Eng.getBuilder(), Eng, Pred, checkFn.Checker,
|
||||||
IsLoad ? ProgramPoint::PreLoadKind :
|
IsLoad ? ProgramPoint::PreLoadKind :
|
||||||
ProgramPoint::PreStoreKind, 0, S, State);
|
ProgramPoint::PreStoreKind, 0, S);
|
||||||
checkFn(Loc, IsLoad, C);
|
checkFn(Loc, IsLoad, C);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -203,10 +200,8 @@ namespace {
|
||||||
void CheckerManager::runCheckersForLocation(ExplodedNodeSet &Dst,
|
void CheckerManager::runCheckersForLocation(ExplodedNodeSet &Dst,
|
||||||
const ExplodedNodeSet &Src,
|
const ExplodedNodeSet &Src,
|
||||||
SVal location, bool isLoad,
|
SVal location, bool isLoad,
|
||||||
const Stmt *S,
|
const Stmt *S, ExprEngine &Eng) {
|
||||||
const GRState *state,
|
CheckLocationContext C(LocationCheckers, location, isLoad, S, Eng);
|
||||||
ExprEngine &Eng) {
|
|
||||||
CheckLocationContext C(LocationCheckers, location, isLoad, S, state, Eng);
|
|
||||||
expandGraphWithCheckers(C, Dst, Src);
|
expandGraphWithCheckers(C, Dst, Src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue