Convert checker over to using ProgramStateRef.
llvm-svn: 149319
This commit is contained in:
parent
7778e6d818
commit
f8c36e005a
|
@ -79,7 +79,7 @@ template<> struct ProgramStateTrait<ArraySizeMap>
|
||||||
|
|
||||||
void ObjCContainersChecker::addSizeInfo(const Expr *Array, const Expr *Size,
|
void ObjCContainersChecker::addSizeInfo(const Expr *Array, const Expr *Size,
|
||||||
CheckerContext &C) const {
|
CheckerContext &C) const {
|
||||||
const ProgramState *State = C.getState();
|
ProgramStateRef State = C.getState();
|
||||||
SVal SizeV = State->getSVal(Size, C.getLocationContext());
|
SVal SizeV = State->getSVal(Size, C.getLocationContext());
|
||||||
// Undefined is reported by another checker.
|
// Undefined is reported by another checker.
|
||||||
if (SizeV.isUnknownOrUndef())
|
if (SizeV.isUnknownOrUndef())
|
||||||
|
@ -124,7 +124,7 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE,
|
||||||
|
|
||||||
// Check the array access.
|
// Check the array access.
|
||||||
if (Name.equals("CFArrayGetValueAtIndex")) {
|
if (Name.equals("CFArrayGetValueAtIndex")) {
|
||||||
const ProgramState *State = C.getState();
|
ProgramStateRef State = C.getState();
|
||||||
// Retrieve the size.
|
// Retrieve the size.
|
||||||
// Find out if we saw this array symbol before and have information about it.
|
// Find out if we saw this array symbol before and have information about it.
|
||||||
const Expr *ArrayExpr = CE->getArg(0);
|
const Expr *ArrayExpr = CE->getArg(0);
|
||||||
|
@ -140,8 +140,8 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE,
|
||||||
|
|
||||||
// Now, check if 'Idx in [0, Size-1]'.
|
// Now, check if 'Idx in [0, Size-1]'.
|
||||||
const QualType T = IdxExpr->getType();
|
const QualType T = IdxExpr->getType();
|
||||||
const ProgramState *StInBound = State->assumeInBound(Idx, Size, true, T);
|
ProgramStateRef StInBound = State->assumeInBound(Idx, Size, true, T);
|
||||||
const ProgramState *StOutBound = State->assumeInBound(Idx, Size, false, T);
|
ProgramStateRef StOutBound = State->assumeInBound(Idx, Size, false, T);
|
||||||
if (StOutBound && !StInBound) {
|
if (StOutBound && !StInBound) {
|
||||||
ExplodedNode *N = C.generateSink(StOutBound);
|
ExplodedNode *N = C.generateSink(StOutBound);
|
||||||
if (!N)
|
if (!N)
|
||||||
|
|
Loading…
Reference in New Issue