aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-25 19:57:06 +0000
committerAnna Zaks <ganna@apple.com>2011-10-25 19:57:06 +0000
commit063e0887ad65d666d23ee3178436ad6507abbd1b (patch)
treed6b5c6724f8607e0a4bf2f9a744856e61c6930db /lib/StaticAnalyzer/Checkers/MallocChecker.cpp
parent2e9264a17bacc7dc228d5f93caaeb98dfb23d508 (diff)
[analyzer] Simplify CheckerContext
Remove dead members/parameters: ProgramState, respondsToCallback, autoTransition. Remove addTransition method since it's the same as generateNode. Maybe we should rename generateNode to genTransition (since a transition is always automatically generated)? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/MallocChecker.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index a04f02493d..edea33ea69 100644
--- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -197,7 +197,7 @@ bool MallocChecker::evalCall(const CallExpr *CE, CheckerContext &C) const {
void MallocChecker::MallocMem(CheckerContext &C, const CallExpr *CE) {
const ProgramState *state = MallocMemAux(C, CE, CE->getArg(0), UndefinedVal(),
C.getState());
- C.addTransition(state);
+ C.generateNode(state);
}
void MallocChecker::MallocMemReturnsAttr(CheckerContext &C, const CallExpr *CE,
@@ -209,12 +209,12 @@ void MallocChecker::MallocMemReturnsAttr(CheckerContext &C, const CallExpr *CE,
if (I != E) {
const ProgramState *state =
MallocMemAux(C, CE, CE->getArg(*I), UndefinedVal(), C.getState());
- C.addTransition(state);
+ C.generateNode(state);
return;
}
const ProgramState *state = MallocMemAux(C, CE, UnknownVal(), UndefinedVal(),
C.getState());
- C.addTransition(state);
+ C.generateNode(state);
}
const ProgramState *MallocChecker::MallocMemAux(CheckerContext &C,
@@ -252,7 +252,7 @@ void MallocChecker::FreeMem(CheckerContext &C, const CallExpr *CE) const {
const ProgramState *state = FreeMemAux(C, CE, C.getState(), 0, false);
if (state)
- C.addTransition(state);
+ C.generateNode(state);
}
void MallocChecker::FreeMemAttr(CheckerContext &C, const CallExpr *CE,
@@ -265,7 +265,7 @@ void MallocChecker::FreeMemAttr(CheckerContext &C, const CallExpr *CE,
const ProgramState *state = FreeMemAux(C, CE, C.getState(), *I,
Att->getOwnKind() == OwnershipAttr::Holds);
if (state)
- C.addTransition(state);
+ C.generateNode(state);
}
}
@@ -531,7 +531,7 @@ void MallocChecker::ReallocMem(CheckerContext &C, const CallExpr *CE) const {
const ProgramState *stateMalloc = MallocMemAux(C, CE, CE->getArg(1),
UndefinedVal(), stateEqual);
- C.addTransition(stateMalloc);
+ C.generateNode(stateMalloc);
}
if (const ProgramState *stateNotEqual = state->assume(PtrEQ, false)) {
@@ -541,7 +541,7 @@ void MallocChecker::ReallocMem(CheckerContext &C, const CallExpr *CE) const {
FreeMemAux(C, CE, stateSizeZero, 0, false)) {
// Bind the return value to NULL because it is now free.
- C.addTransition(stateFree->BindExpr(CE, svalBuilder.makeNull(), true));
+ C.generateNode(stateFree->BindExpr(CE, svalBuilder.makeNull(), true));
}
if (const ProgramState *stateSizeNotZero = stateNotEqual->assume(SizeZero,false))
if (const ProgramState *stateFree = FreeMemAux(C, CE, stateSizeNotZero,
@@ -549,7 +549,7 @@ void MallocChecker::ReallocMem(CheckerContext &C, const CallExpr *CE) const {
// FIXME: We should copy the content of the original buffer.
const ProgramState *stateRealloc = MallocMemAux(C, CE, CE->getArg(1),
UnknownVal(), stateFree);
- C.addTransition(stateRealloc);
+ C.generateNode(stateRealloc);
}
}
}
@@ -564,7 +564,7 @@ void MallocChecker::CallocMem(CheckerContext &C, const CallExpr *CE) {
svalBuilder.getContext().getSizeType());
SVal zeroVal = svalBuilder.makeZeroVal(svalBuilder.getContext().CharTy);
- C.addTransition(MallocMemAux(C, CE, TotalSize, zeroVal, state));
+ C.generateNode(MallocMemAux(C, CE, TotalSize, zeroVal, state));
}
void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper,
@@ -642,7 +642,7 @@ void MallocChecker::checkPreStmt(const ReturnStmt *S, CheckerContext &C) const {
if (RS->isAllocated())
state = state->set<RegionState>(Sym, RefState::getEscaped(S));
- C.addTransition(state);
+ C.generateNode(state);
}
const ProgramState *MallocChecker::evalAssume(const ProgramState *state, SVal Cond,
@@ -707,7 +707,7 @@ void MallocChecker::checkBind(SVal location, SVal val,
// Generate a transition for 'nullState' to record the assumption
// that the state was null.
if (nullState)
- C.addTransition(nullState);
+ C.generateNode(nullState);
if (!notNullState)
return;
@@ -735,7 +735,7 @@ void MallocChecker::checkBind(SVal location, SVal val,
}
while (false);
}
- C.addTransition(notNullState);
+ C.generateNode(notNullState);
}
}
}