CheckerContext C(Dst, Builder, Eng, Pred, tag,
isLoad ? ProgramPoint::PreLoadKind :
ProgramPoint::PreStoreKind, 0, S, state);
- visitLocation(C, S, location);
+ visitLocation(C, S, location, isLoad);
}
void GR_evalDeadSymbols(ExplodedNodeSet &Dst, StmtNodeBuilder &Builder,
virtual ~Checker();
virtual void _PreVisit(CheckerContext &C, const Stmt *S) {}
virtual void _PostVisit(CheckerContext &C, const Stmt *S) {}
- virtual void visitLocation(CheckerContext &C, const Stmt *S, SVal location) {}
+ virtual void visitLocation(CheckerContext &C, const Stmt *S, SVal location,
+ bool isLoad) {}
virtual void PreVisitBind(CheckerContext &C, const Stmt *StoreE,
SVal location, SVal val) {}
virtual void evalDeadSymbols(CheckerContext &C, SymbolReaper &SymReaper) {}
public:
ArrayBoundChecker() : BT(0) {}
static void *getTag() { static int x = 0; return &x; }
- void visitLocation(CheckerContext &C, const Stmt *S, SVal l);
+ void visitLocation(CheckerContext &C, const Stmt *S, SVal l, bool isLoad);
};
}
Eng.registerCheck(new ArrayBoundChecker());
}
-void ArrayBoundChecker::visitLocation(CheckerContext &C, const Stmt *S, SVal l){
+void ArrayBoundChecker::visitLocation(CheckerContext &C, const Stmt *S, SVal l,
+ bool isLoad) {
// Check for out of bound array element access.
const MemRegion *R = l.getAsRegion();
if (!R)
public:
ArrayBoundCheckerV2() : BT(0) {}
static void *getTag() { static int x = 0; return &x; }
- void visitLocation(CheckerContext &C, const Stmt *S, SVal l);
+ void visitLocation(CheckerContext &C, const Stmt *S, SVal l, bool isLoad);
};
// FIXME: Eventually replace RegionRawOffset with this class.
void ArrayBoundCheckerV2::visitLocation(CheckerContext &checkerContext,
const Stmt *S,
- SVal location) {
+ SVal location, bool isLoad) {
// NOTE: Instead of using GRState::assumeInBound(), we are prototyping
// some new logic here that reasons directly about memory region extents.
public:
DereferenceChecker() : BT_null(0), BT_undef(0) {}
static void *getTag() { static int tag = 0; return &tag; }
- void visitLocation(CheckerContext &C, const Stmt *S, SVal location);
+ void visitLocation(CheckerContext &C, const Stmt *S, SVal location,
+ bool isLoad);
std::pair<ExplodedNode * const*, ExplodedNode * const*>
getImplicitNodes() const {
}
void DereferenceChecker::visitLocation(CheckerContext &C, const Stmt *S,
- SVal l) {
+ SVal l, bool isLoad) {
// Check for dereference of an undefined value.
if (l.isUndef()) {
if (ExplodedNode *N = C.generateSink()) {
void PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *S);
const GRState *evalAssume(const GRState *state, SVal Cond, bool Assumption,
bool *respondsToCallback);
- void visitLocation(CheckerContext &C, const Stmt *S, SVal l);
+ void visitLocation(CheckerContext &C, const Stmt *S, SVal l, bool isLoad);
virtual void PreVisitBind(CheckerContext &C, const Stmt *StoreE,
SVal location, SVal val);
}
// Check if the location is a freed symbolic region.
-void MallocChecker::visitLocation(CheckerContext &C, const Stmt *S, SVal l) {
+void MallocChecker::visitLocation(CheckerContext &C, const Stmt *S, SVal l,
+ bool isLoad) {
SymbolRef Sym = l.getLocSymbolInBase();
if (Sym) {
const RefState *RS = C.getState()->get<RegionState>(Sym);