aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Checker/PathSensitive/GRState.h20
-rw-r--r--lib/Checker/AdjustedReturnValueChecker.cpp4
-rw-r--r--lib/Checker/AttrNonNullChecker.cpp4
-rw-r--r--lib/Checker/BasicObjCFoundationChecks.cpp10
-rw-r--r--lib/Checker/BugReporter.cpp4
-rw-r--r--lib/Checker/BugReporterVisitors.cpp6
-rw-r--r--lib/Checker/BuiltinFunctionChecker.cpp6
-rw-r--r--lib/Checker/CFRefCount.cpp31
-rw-r--r--lib/Checker/CallAndMessageChecker.cpp8
-rw-r--r--lib/Checker/CallInliner.cpp2
-rw-r--r--lib/Checker/DivZeroChecker.cpp2
-rw-r--r--lib/Checker/FixedAddressChecker.cpp2
-rw-r--r--lib/Checker/GRExprEngine.cpp94
-rw-r--r--lib/Checker/GRState.cpp8
-rw-r--r--lib/Checker/MallocChecker.cpp13
-rw-r--r--lib/Checker/NSErrorChecker.cpp5
-rw-r--r--lib/Checker/NoReturnFunctionChecker.cpp2
-rw-r--r--lib/Checker/OSAtomicChecker.cpp10
-rw-r--r--lib/Checker/PointerArithChecker.cpp4
-rw-r--r--lib/Checker/PointerSubChecker.cpp4
-rw-r--r--lib/Checker/PthreadLockChecker.cpp10
-rw-r--r--lib/Checker/RegionStore.cpp2
-rw-r--r--lib/Checker/ReturnPointerRangeChecker.cpp2
-rw-r--r--lib/Checker/ReturnStackAddressChecker.cpp2
-rw-r--r--lib/Checker/ReturnUndefChecker.cpp2
-rw-r--r--lib/Checker/UndefBranchChecker.cpp4
-rw-r--r--lib/Checker/UndefResultChecker.cpp6
-rw-r--r--lib/Checker/UndefinedArraySubscriptChecker.cpp2
-rw-r--r--lib/Checker/VLASizeChecker.cpp2
29 files changed, 133 insertions, 138 deletions
diff --git a/include/clang/Checker/PathSensitive/GRState.h b/include/clang/Checker/PathSensitive/GRState.h
index 9e4ed02d5a..4e44697a27 100644
--- a/include/clang/Checker/PathSensitive/GRState.h
+++ b/include/clang/Checker/PathSensitive/GRState.h
@@ -252,15 +252,15 @@ public:
const llvm::APSInt *getSymVal(SymbolRef sym) const;
- SVal getExprVal(const Stmt* Ex) const;
+ SVal getSVal(const Stmt* Ex) const;
- SVal getExprValAsScalarOrLoc(const Stmt *Ex) const;
+ SVal getSValAsScalarOrLoc(const Stmt *Ex) const;
- SVal Load(Loc LV, QualType T = QualType()) const;
+ SVal getSVal(Loc LV, QualType T = QualType()) const;
- SVal Load(const MemRegion* R) const;
+ SVal getSVal(const MemRegion* R) const;
- SVal LoadAsScalarOrLoc(const MemRegion *R) const;
+ SVal getSValAsScalarOrLoc(const MemRegion *R) const;
const llvm::APSInt *getSymVal(SymbolRef sym);
@@ -661,25 +661,25 @@ inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
return getStateManager().getSymVal(this, sym);
}
-inline SVal GRState::getExprVal(const Stmt* Ex) const {
+inline SVal GRState::getSVal(const Stmt* Ex) const {
return Env.GetSVal(Ex, getStateManager().ValueMgr);
}
-inline SVal GRState::getExprValAsScalarOrLoc(const Stmt *S) const {
+inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
if (const Expr *Ex = dyn_cast<Expr>(S)) {
QualType T = Ex->getType();
if (Loc::IsLocType(T) || T->isIntegerType())
- return getExprVal(S);
+ return getSVal(S);
}
return UnknownVal();
}
-inline SVal GRState::Load(Loc LV, QualType T) const {
+inline SVal GRState::getSVal(Loc LV, QualType T) const {
return getStateManager().StoreMgr->Retrieve(St, LV, T);
}
-inline SVal GRState::Load(const MemRegion* R) const {
+inline SVal GRState::getSVal(const MemRegion* R) const {
return getStateManager().StoreMgr->Retrieve(St, loc::MemRegionVal(R));
}
diff --git a/lib/Checker/AdjustedReturnValueChecker.cpp b/lib/Checker/AdjustedReturnValueChecker.cpp
index 3abaa5f33f..e95a86b838 100644
--- a/lib/Checker/AdjustedReturnValueChecker.cpp
+++ b/lib/Checker/AdjustedReturnValueChecker.cpp
@@ -49,7 +49,7 @@ void AdjustedReturnValueChecker::PostVisitCallExpr(CheckerContext &C,
// Fetch the signature of the called function.
const GRState *state = C.getState();
- SVal V = state->getExprVal(CE);
+ SVal V = state->getSVal(CE);
if (V.isUnknown())
return;
@@ -60,7 +60,7 @@ void AdjustedReturnValueChecker::PostVisitCallExpr(CheckerContext &C,
return;
}
- const MemRegion *callee = state->getExprVal(CE->getCallee()).getAsRegion();
+ const MemRegion *callee = state->getSVal(CE->getCallee()).getAsRegion();
if (!callee)
return;
diff --git a/lib/Checker/AttrNonNullChecker.cpp b/lib/Checker/AttrNonNullChecker.cpp
index 496c67c9ec..83dc13e92b 100644
--- a/lib/Checker/AttrNonNullChecker.cpp
+++ b/lib/Checker/AttrNonNullChecker.cpp
@@ -41,7 +41,7 @@ void AttrNonNullChecker::PreVisitCallExpr(CheckerContext &C,
const GRState *state = C.getState();
// Check if the callee has a 'nonnull' attribute.
- SVal X = state->getExprVal(CE->getCallee());
+ SVal X = state->getSVal(CE->getCallee());
const FunctionDecl* FD = X.getAsFunctionDecl();
if (!FD)
@@ -60,7 +60,7 @@ void AttrNonNullChecker::PreVisitCallExpr(CheckerContext &C,
if (!Att->isNonNull(idx))
continue;
- const SVal &V = state->getExprVal(*I);
+ const SVal &V = state->getSVal(*I);
const DefinedSVal *DV = dyn_cast<DefinedSVal>(&V);
if (!DV)
diff --git a/lib/Checker/BasicObjCFoundationChecks.cpp b/lib/Checker/BasicObjCFoundationChecks.cpp
index 42cfb1e545..b1ecfeb144 100644
--- a/lib/Checker/BasicObjCFoundationChecks.cpp
+++ b/lib/Checker/BasicObjCFoundationChecks.cpp
@@ -135,7 +135,7 @@ bool BasicObjCFoundationChecks::CheckNilArg(ExplodedNode* N, unsigned Arg) {
const Expr * E = ME->getArg(Arg);
- if (isNil(N->getState()->getExprVal(E))) {
+ if (isNil(N->getState()->getSVal(E))) {
WarnNilArg(N, ME, Arg);
return true;
}
@@ -349,14 +349,14 @@ bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){
const CallExpr* CE =
cast<CallExpr>(cast<PostStmt>(N->getLocation()).getStmt());
const Expr* Callee = CE->getCallee();
- SVal CallV = N->getState()->getExprVal(Callee);
+ SVal CallV = N->getState()->getSVal(Callee);
const FunctionDecl* FD = CallV.getAsFunctionDecl();
if (!FD || FD->getIdentifier() != II || CE->getNumArgs()!=3)
return false;
// Get the value of the "theType" argument.
- SVal TheTypeVal = N->getState()->getExprVal(CE->getArg(1));
+ SVal TheTypeVal = N->getState()->getSVal(CE->getArg(1));
// FIXME: We really should allow ranges of valid theType values, and
// bifurcate the state appropriately.
@@ -375,7 +375,7 @@ bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){
// Look at the value of the integer being passed by reference. Essentially
// we want to catch cases where the value passed in is not equal to the
// size of the type being created.
- SVal TheValueExpr = N->getState()->getExprVal(CE->getArg(2));
+ SVal TheValueExpr = N->getState()->getSVal(CE->getArg(2));
// FIXME: Eventually we should handle arbitrary locations. We can do this
// by having an enhanced memory model that does low-level typing.
@@ -482,7 +482,7 @@ bool AuditCFRetainRelease::Audit(ExplodedNode* N, GRStateManager&) {
// Check if we called CFRetain/CFRelease.
const GRState* state = N->getState();
- SVal X = state->getExprVal(CE->getCallee());
+ SVal X = state->getSVal(CE->getCallee());
const FunctionDecl* FD = X.getAsFunctionDecl();
if (!FD)
diff --git a/lib/Checker/BugReporter.cpp b/lib/Checker/BugReporter.cpp
index 34d05f995b..0cf593b260 100644
--- a/lib/Checker/BugReporter.cpp
+++ b/lib/Checker/BugReporter.cpp
@@ -350,7 +350,7 @@ GetMostRecentVarDeclBinding(const ExplodedNode* N,
if (!DR)
continue;
- SVal Y = N->getState()->getExprVal(DR);
+ SVal Y = N->getState()->getSVal(DR);
if (X != Y)
continue;
@@ -394,7 +394,7 @@ public:
return true;
// Check if the previous state has this binding.
- SVal X = PrevSt->Load(loc::MemRegionVal(R));
+ SVal X = PrevSt->getSVal(loc::MemRegionVal(R));
if (X == V) // Same binding?
return true;
diff --git a/lib/Checker/BugReporterVisitors.cpp b/lib/Checker/BugReporterVisitors.cpp
index 31a2e658e9..b8f657b31b 100644
--- a/lib/Checker/BugReporterVisitors.cpp
+++ b/lib/Checker/BugReporterVisitors.cpp
@@ -113,7 +113,7 @@ public:
}
}
- if (Node->getState()->Load(R) != V)
+ if (Node->getState()->getSVal(R) != V)
break;
}
@@ -319,7 +319,7 @@ void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
StateMgr.getRegionManager().getVarRegion(VD, N->getLocationContext());
// What did we load?
- SVal V = state->getExprVal(S);
+ SVal V = state->getSVal(S);
if (isa<loc::ConcreteInt>(V) || isa<nonloc::ConcreteInt>(V)
|| V.isUndef()) {
@@ -328,7 +328,7 @@ void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
}
}
- SVal V = state->getExprValAsScalarOrLoc(S);
+ SVal V = state->getSValAsScalarOrLoc(S);
// Uncomment this to find cases where we aren't properly getting the
// base value that was dereferenced.
diff --git a/lib/Checker/BuiltinFunctionChecker.cpp b/lib/Checker/BuiltinFunctionChecker.cpp
index 9739b3d9ad..8711492049 100644
--- a/lib/Checker/BuiltinFunctionChecker.cpp
+++ b/lib/Checker/BuiltinFunctionChecker.cpp
@@ -35,7 +35,7 @@ void clang::RegisterBuiltinFunctionChecker(GRExprEngine &Eng) {
bool BuiltinFunctionChecker::EvalCallExpr(CheckerContext &C,const CallExpr *CE){
const GRState *state = C.getState();
const Expr *Callee = CE->getCallee();
- SVal L = state->getExprVal(Callee);
+ SVal L = state->getSVal(Callee);
const FunctionDecl *FD = L.getAsFunctionDecl();
if (!FD)
@@ -50,7 +50,7 @@ bool BuiltinFunctionChecker::EvalCallExpr(CheckerContext &C,const CallExpr *CE){
case Builtin::BI__builtin_expect: {
// For __builtin_expect, just return the value of the subexpression.
assert (CE->arg_begin() != CE->arg_end());
- SVal X = state->getExprVal(*(CE->arg_begin()));
+ SVal X = state->getSVal(*(CE->arg_begin()));
C.GenerateNode(state->BindExpr(CE, X));
return true;
}
@@ -65,7 +65,7 @@ bool BuiltinFunctionChecker::EvalCallExpr(CheckerContext &C,const CallExpr *CE){
// Set the extent of the region in bytes. This enables us to use the
// SVal of the argument directly. If we save the extent in bits, we
// cannot represent values like symbol*8.
- SVal Extent = state->getExprVal(*(CE->arg_begin()));
+ SVal Extent = state->getSVal(*(CE->arg_begin()));
state = C.getStoreManager().setExtent(state, R, Extent);
C.GenerateNode(state->BindExpr(CE, loc::MemRegionVal(R)));
return true;
diff --git a/lib/Checker/CFRefCount.cpp b/lib/Checker/CFRefCount.cpp
index 79440e5ab1..85d9dbdce1 100644
--- a/lib/Checker/CFRefCount.cpp
+++ b/lib/Checker/CFRefCount.cpp
@@ -1399,7 +1399,7 @@ RetainSummaryManager::getInstanceMethodSummary(const ObjCMessageExpr *ME,
// FIXME: Is this really working as expected? There are cases where
// we just use the 'ID' from the message expression.
- SVal receiverV = state->getExprValAsScalarOrLoc(Receiver);
+ SVal receiverV = state->getSValAsScalarOrLoc(Receiver);
// FIXME: Eventually replace the use of state->get<RefBindings> with
// a generic API for reasoning about the Objective-C types of symbolic
@@ -1428,7 +1428,7 @@ RetainSummaryManager::getInstanceMethodSummary(const ObjCMessageExpr *ME,
if (const loc::MemRegionVal *L = dyn_cast<loc::MemRegionVal>(&receiverV)) {
// Get the region associated with 'self'.
if (const ImplicitParamDecl *SelfDecl = LC->getSelfDecl()) {
- SVal SelfVal = state->Load(state->getRegion(SelfDecl, LC));
+ SVal SelfVal = state->getSVal(state->getRegion(SelfDecl, LC));
if (L->StripCasts() == SelfVal.getAsRegion()) {
// Update the summary to make the default argument effect
// 'StopTracking'.
@@ -2140,7 +2140,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
// Get the name of the callee (if it is available).
- SVal X = CurrSt->getExprValAsScalarOrLoc(CE->getCallee());
+ SVal X = CurrSt->getSValAsScalarOrLoc(CE->getCallee());
if (const FunctionDecl* FD = X.getAsFunctionDecl())
os << "Call to function '" << FD->getNameAsString() <<'\'';
else
@@ -2197,7 +2197,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
// Retrieve the value of the argument. Is it the symbol
// we are interested in?
- if (CurrSt->getExprValAsScalarOrLoc(*AI).getAsLocSymbol() != Sym)
+ if (CurrSt->getSValAsScalarOrLoc(*AI).getAsLocSymbol() != Sym)
continue;
// We have an argument. Get the effect!
@@ -2206,7 +2206,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
}
else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S)) {
if (const Expr *receiver = ME->getReceiver())
- if (CurrSt->getExprValAsScalarOrLoc(receiver).getAsLocSymbol() == Sym) {
+ if (CurrSt->getSValAsScalarOrLoc(receiver).getAsLocSymbol() == Sym) {
// The symbol we are tracking is the receiver.
AEffects.push_back(Summ->getReceiverEffect());
}
@@ -2234,7 +2234,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
if (contains(AEffects, MakeCollectable)) {
// Get the name of the function.
const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
- SVal X = CurrSt->getExprValAsScalarOrLoc(cast<CallExpr>(S)->getCallee());
+ SVal X = CurrSt->getSValAsScalarOrLoc(cast<CallExpr>(S)->getCallee());
const FunctionDecl* FD = X.getAsFunctionDecl();
const std::string& FName = FD->getNameAsString();
@@ -2346,7 +2346,7 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode* N,
for (Stmt::const_child_iterator I = S->child_begin(), E = S->child_end();
I!=E; ++I)
if (const Expr* Exp = dyn_cast_or_null<Expr>(*I))
- if (CurrSt->getExprValAsScalarOrLoc(Exp).getAsLocSymbol() == Sym) {
+ if (CurrSt->getSValAsScalarOrLoc(Exp).getAsLocSymbol() == Sym) {
P->addRange(Exp->getSourceRange());
break;
}
@@ -2597,7 +2597,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
llvm::SmallVector<const MemRegion*, 10> RegionsToInvalidate;
for (ExprIterator I = arg_beg; I != arg_end; ++I, ++idx) {
- SVal V = state->getExprValAsScalarOrLoc(*I);
+ SVal V = state->getSValAsScalarOrLoc(*I);
SymbolRef Sym = V.getAsLocSymbol();
if (Sym)
@@ -2698,7 +2698,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
// Evaluate the effect on the message receiver.
if (!ErrorExpr && Receiver) {
- SymbolRef Sym = state->getExprValAsScalarOrLoc(Receiver).getAsLocSymbol();
+ SymbolRef Sym = state->getSValAsScalarOrLoc(Receiver).getAsLocSymbol();
if (Sym) {
if (const RefVal* T = state->get<RefBindings>(Sym)) {
state = Update(state, Sym, *T, Summ.getReceiverEffect(), hasErr);
@@ -2722,7 +2722,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
if (RE.getKind() == RetEffect::OwnedWhenTrackedReceiver) {
assert(Receiver);
- SVal V = state->getExprValAsScalarOrLoc(Receiver);
+ SVal V = state->getSValAsScalarOrLoc(Receiver);
bool found = false;
if (SymbolRef Sym = V.getAsLocSymbol())
if (state->get<RefBindings>(Sym)) {
@@ -2751,8 +2751,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
// For CallExpr, use the result type to know if it returns a reference.
if (const CallExpr *CE = dyn_cast<CallExpr>(Ex)) {
const Expr *Callee = CE->getCallee();
- if (const FunctionDecl *FD =
- state->getExprVal(Callee).getAsFunctionDecl())
+ if (const FunctionDecl *FD = state->getSVal(Callee).getAsFunctionDecl())
T = FD->getResultType();
}
else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(Ex)) {
@@ -2774,14 +2773,14 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
unsigned idx = RE.getIndex();
assert (arg_end >= arg_beg);
assert (idx < (unsigned) (arg_end - arg_beg));
- SVal V = state->getExprValAsScalarOrLoc(*(arg_beg+idx));
+ SVal V = state->getSValAsScalarOrLoc(*(arg_beg+idx));
state = state->BindExpr(Ex, V, false);
break;
}
case RetEffect::ReceiverAlias: {
assert (Receiver);
- SVal V = state->getExprValAsScalarOrLoc(Receiver);
+ SVal V = state->getSValAsScalarOrLoc(Receiver);
state = state->BindExpr(Ex, V, false);
break;
}
@@ -2938,7 +2937,7 @@ void CFRefCount::EvalReturn(ExplodedNodeSet& Dst,
return;
const GRState *state = Builder.GetState(Pred);
- SymbolRef Sym = state->getExprValAsScalarOrLoc(RetE).getAsLocSymbol();
+ SymbolRef Sym = state->getSValAsScalarOrLoc(RetE).getAsLocSymbol();
if (!Sym)
return;
@@ -3493,7 +3492,7 @@ void RetainReleaseChecker::PostVisitBlockExpr(CheckerContext &C,
const GRState *state = C.getState();
const BlockDataRegion *R =
- cast<BlockDataRegion>(state->getExprVal(BE).getAsRegion());
+ cast<BlockDataRegion>(state->getSVal(BE).getAsRegion());
BlockDataRegion::referenced_vars_iterator I = R->referenced_vars_begin(),
E = R->referenced_vars_end();
diff --git a/lib/Checker/CallAndMessageChecker.cpp b/lib/Checker/CallAndMessageChecker.cpp
index 9ae5dc54a8..9013c3818b 100644
--- a/lib/Checker/CallAndMessageChecker.cpp
+++ b/lib/Checker/CallAndMessageChecker.cpp
@@ -73,7 +73,7 @@ void CallAndMessageChecker::PreVisitCallExpr(CheckerContext &C,
const CallExpr *CE){
const Expr *Callee = CE->getCallee()->IgnoreParens();
- SVal L = C.getState()->getExprVal(Callee);
+ SVal L = C.getState()->getSVal(Callee);
if (L.isUndef()) {
if (!BT_call_undef)
@@ -92,7 +92,7 @@ void CallAndMessageChecker::PreVisitCallExpr(CheckerContext &C,
for (CallExpr::const_arg_iterator I = CE->arg_begin(), E = CE->arg_end();
I != E; ++I) {
- if (C.getState()->getExprVal(*I).isUndef()) {
+ if (C.getState()->getSVal(*I).isUndef()) {
if (ExplodedNode *N = C.GenerateSink()) {
if (!BT_call_arg)
BT_call_arg = new BuiltinBug("Pass-by-value argument in function call"
@@ -115,7 +115,7 @@ void CallAndMessageChecker::PreVisitObjCMessageExpr(CheckerContext &C,
const GRState *state = C.getState();
if (const Expr *receiver = ME->getReceiver())
- if (state->getExprVal(receiver).isUndef()) {
+ if (state->getSVal(receiver).isUndef()) {
if (ExplodedNode *N = C.GenerateSink()) {
if (!BT_msg_undef)
BT_msg_undef =
@@ -133,7 +133,7 @@ void CallAndMessageChecker::PreVisitObjCMessageExpr(CheckerContext &C,
// Check for any arguments that are uninitialized/undefined.
for (ObjCMessageExpr::const_arg_iterator I = ME->arg_begin(),
E = ME->arg_end(); I != E; ++I) {
- if (state->getExprVal(*I).isUndef()) {
+ if (state->getSVal(*I).isUndef()) {
if (ExplodedNode *N = C.GenerateSink()) {
if (!BT_msg_arg)
BT_msg_arg =
diff --git a/lib/Checker/CallInliner.cpp b/lib/Checker/CallInliner.cpp
index 3feca9784b..d94994b194 100644
--- a/lib/Checker/CallInliner.cpp
+++ b/lib/Checker/CallInliner.cpp
@@ -37,7 +37,7 @@ void clang::RegisterCallInliner(GRExprEngine &Eng) {
bool CallInliner::EvalCallExpr(CheckerContext &C, const CallExpr *CE) {
const GRState *state = C.getState();
const Expr *Callee = CE->getCallee();
- SVal L = state->getExprVal(Callee);
+ SVal L = state->getSVal(Callee);
const FunctionDecl *FD = L.getAsFunctionDecl();
if (!FD)
diff --git a/lib/Checker/DivZeroChecker.cpp b/lib/Checker/DivZeroChecker.cpp
index 39fdeaba2b..e1346e11b6 100644
--- a/lib/Checker/DivZeroChecker.cpp
+++ b/lib/Checker/DivZeroChecker.cpp
@@ -49,7 +49,7 @@ void DivZeroChecker::PreVisitBinaryOperator(CheckerContext &C,
!B->getRHS()->getType()->isScalarType())
return;
- SVal Denom = C.getState()->getExprVal(B->getRHS());
+ SVal Denom = C.getState()->getSVal(B->getRHS());
const DefinedSVal *DV = dyn_cast<DefinedSVal>(&Denom);
// Divide-by-undefined handled in the generic checking for uses of
diff --git a/lib/Checker/FixedAddressChecker.cpp b/lib/Checker/FixedAddressChecker.cpp
index 6ed31a788b..04c17d6d7a 100644
--- a/lib/Checker/FixedAddressChecker.cpp
+++ b/lib/Checker/FixedAddressChecker.cpp
@@ -48,7 +48,7 @@ void FixedAddressChecker::PreVisitBinaryOperator(CheckerContext &C,
const GRState *state = C.getState();
- SVal RV = state->getExprVal(B->getRHS());
+ SVal RV = state->getSVal(B->getRHS());
if (!RV.isConstant() || RV.isZeroConstant())
return;
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp
index 72456cc311..978be8dc64 100644
--- a/lib/Checker/GRExprEngine.cpp
+++ b/lib/Checker/GRExprEngine.cpp
@@ -392,7 +392,7 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
if (!R)
break;
- SVal V = state->Load(loc::MemRegionVal(R));
+ SVal V = state->getSVal(loc::MemRegionVal(R));
SVal Constraint_untested = EvalBinOp(state, BinaryOperator::GT, V,
ValMgr.makeZeroVal(T),
getContext().IntTy);
@@ -414,7 +414,7 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
// method.
const ImplicitParamDecl *SelfD = MD->getSelfDecl();
const MemRegion *R = state->getRegion(SelfD, InitLoc);
- SVal V = state->Load(loc::MemRegionVal(R));
+ SVal V = state->getSVal(loc::MemRegionVal(R));
if (const Loc *LV = dyn_cast<Loc>(&V)) {
// Assume that the pointer value in 'self' is non-null.
@@ -633,8 +633,7 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
}
else if (B->getOpcode() == BinaryOperator::Comma) {
const GRState* state = GetState(Pred);
- MakeNode(Dst, B, Pred, state->BindExpr(B,
- state->getExprVal(B->getRHS())));
+ MakeNode(Dst, B, Pred, state->BindExpr(B, state->getSVal(B->getRHS())));
break;
}
@@ -765,8 +764,7 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
if (Expr* LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin())) {
const GRState* state = GetState(Pred);
- MakeNode(Dst, SE, Pred, state->BindExpr(SE,
- state->getExprVal(LastExpr)));
+ MakeNode(Dst, SE, Pred, state->BindExpr(SE, state->getSVal(LastExpr)));
}
else
Dst.Add(Pred);
@@ -1045,7 +1043,7 @@ static SVal RecoverCastedSymbol(GRStateManager& StateMgr, const GRState* state,
if (!bitsInit || !T->isIntegerType() || Ctx.getTypeSize(T) > bits)
return UnknownVal();
- return state->getExprVal(Ex);
+ return state->getSVal(Ex);
}
void GRExprEngine::ProcessBranch(Stmt* Condition, Stmt* Term,
@@ -1072,7 +1070,7 @@ void GRExprEngine::ProcessBranch(Stmt* Condition, Stmt* Term,
return;
const GRState* PrevState = builder.getState();
- SVal X = PrevState->getExprVal(Condition);
+ SVal X = PrevState->getSVal(Condition);
if (X.isUnknown()) {
// Give it a chance to recover from unknown.
@@ -1123,7 +1121,7 @@ void GRExprEngine::ProcessBranch(Stmt* Condition, Stmt* Term,
void GRExprEngine::ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) {
const GRState *state = builder.getState();
- SVal V = state->getExprVal(builder.getTarget());
+ SVal V = state->getSVal(builder.getTarget());
// Three possibilities:
//
@@ -1171,13 +1169,13 @@ void GRExprEngine::VisitGuardedExpr(Expr* Ex, Expr* L, Expr* R,
Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
const GRState* state = GetState(Pred);
- SVal X = state->getExprVal(Ex);
+ SVal X = state->getSVal(Ex);
assert (X.isUndef());
Expr *SE = (Expr*) cast<UndefinedVal>(X).getData();
assert(SE);
- X = state->getExprVal(SE);
+ X = state->getSVal(SE);
// Make sure that we invalidate the previous binding.
MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, X, true));
@@ -1201,7 +1199,7 @@ void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) {
typedef GRSwitchNodeBuilder::iterator iterator;
const GRState* state = builder.getState();
Expr* CondE = builder.getCondition();
- SVal CondV_untested = state->getExprVal(CondE);
+ SVal CondV_untested = state->getSVal(CondE);
if (CondV_untested.isUndef()) {
//ExplodedNode* N = builder.generateDefaultCaseNode(state, true);
@@ -1302,14 +1300,14 @@ void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, ExplodedNode* Pred,
assert(B==CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
const GRState* state = GetState(Pred);
- SVal X = state->getExprVal(B);
+ SVal X = state->getSVal(B);
assert(X.isUndef());
const Expr *Ex = (const Expr*) cast<UndefinedVal>(X).getData();
assert(Ex);
if (Ex == B->getRHS()) {
- X = state->getExprVal(Ex);
+ X = state->getSVal(Ex);
// Handle undefined values.
if (X.isUndef()) {
@@ -1389,7 +1387,7 @@ void GRExprEngine::VisitCommonDeclRefExpr(Expr *Ex, const NamedDecl *D,
// reference region.
if (VD->getType()->isReferenceType()) {
if (const MemRegion *R = V.getAsRegion())
- V = state->Load(R);
+ V = state->getSVal(R);
else
V = UnknownVal();
}
@@ -1448,8 +1446,8 @@ void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A,
for (ExplodedNodeSet::iterator I2=Tmp3.begin(),E2=Tmp3.end();I2!=E2; ++I2) {
const GRState* state = GetState(*I2);
- SVal V = state->getLValue(A->getType(), state->getExprVal(Idx),
- state->getExprVal(Base));
+ SVal V = state->getLValue(A->getType(), state->getSVal(Idx),
+ state->getSVal(Base));
if (asLValue)
MakeNode(Dst, A, *I2, state->BindExpr(A, V),
@@ -1481,7 +1479,7 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, ExplodedNode* Pred,
// FIXME: Should we insert some assumption logic in here to determine
// if "Base" is a valid piece of memory? Before we put this assumption
// later when using FieldOffset lvals (which we no longer have).
- SVal L = state->getLValue(Field, state->getExprVal(Base));
+ SVal L = state->getLValue(Field, state->getSVal(Base));
if (asLValue)
MakeNode(Dst, M, *I, state->BindExpr(M, L), ProgramPoint::PostLValueKind);
@@ -1593,7 +1591,7 @@ void GRExprEngine::EvalLoad(ExplodedNodeSet& Dst, Expr *Ex, ExplodedNode* Pred,
// Perform the load from the referenced value.
for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end() ; I!=E; ++I) {
state = GetState(*I);
- location = state->getExprVal(Ex);
+ location = state->getSVal(Ex);
EvalLoadCommon(Dst, Ex, *I, state, location, tag, LoadTy);
}
return;
@@ -1629,7 +1627,7 @@ void GRExprEngine::EvalLoadCommon(ExplodedNodeSet& Dst, Expr *Ex,
ProgramPoint::PostLoadKind, tag);
}
else {
- SVal V = state->Load(cast<Loc>(location), LoadTy.isNull() ?
+ SVal V = state->getSVal(cast<Loc>(location), LoadTy.isNull() ?
Ex->getType() : LoadTy);
MakeNode(Dst, Ex, *NI, state->BindExpr(Ex, V), ProgramPoint::PostLoadKind,
tag);
@@ -1762,7 +1760,7 @@ void GRExprEngine::VisitCall(CallExpr* CE, ExplodedNode* Pred,
DI != DE; ++DI) {
const GRState* state = GetState(*DI);
- SVal L = state->getExprVal(Callee);
+ SVal L = state->getSVal(Callee);
// FIXME: Add support for symbolic function calls (calls involving
// function pointer values that are symbolic).
@@ -1817,7 +1815,7 @@ void GRExprEngine::VisitCall(CallExpr* CE, ExplodedNode* Pred,
for (ExplodedNodeSet::iterator NI = DstTmp4.begin(), NE = DstTmp4.end();
NI!=NE; ++NI) {
const GRState *state = GetState(*NI);
- EvalLoad(Dst, CE, *NI, state, state->getExprVal(CE),
+ EvalLoad(Dst, CE, *NI, state, state->getSVal(CE),
&ConvertToRvalueTag, LoadTy);
}
}
@@ -1844,7 +1842,7 @@ void GRExprEngine::EvalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
}
const GRState* state = Pred->getState();
- SVal V = state->getExprVal(Ex);
+ SVal V = state->getSVal(Ex);
if (nonloc::SymExprVal *SEV = dyn_cast<nonloc::SymExprVal>(&V)) {
// First assume that the condition is true.
if (const GRState *stateTrue = state->Assume(*SEV, true)) {
@@ -1882,7 +1880,7 @@ void GRExprEngine::VisitObjCIvarRefExpr(ObjCIvarRefExpr* Ex, ExplodedNode* Pred,
for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
const GRState* state = GetState(*I);
- SVal BaseVal = state->getExprVal(Base);
+ SVal BaseVal = state->getSVal(Base);
SVal location = state->getLValue(Ex->getDecl(), BaseVal);
if (asLValue)
@@ -1940,7 +1938,7 @@ void GRExprEngine::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S,
for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
const GRState* state = GetState(*I);
- VisitObjCForCollectionStmtAux(S, *I, Dst, state->getExprVal(elem));
+ VisitObjCForCollectionStmtAux(S, *I, Dst, state->getSVal(elem));
}
}
@@ -2064,7 +2062,7 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
// Bifurcate the state into nil and non-nil ones.
DefinedOrUnknownSVal receiverVal =
- cast<DefinedOrUnknownSVal>(state->getExprVal(Receiver));
+ cast<DefinedOrUnknownSVal>(state->getSVal(Receiver));
const GRState *notNilState, *nilState;
llvm::tie(notNilState, nilState) = state->Assume(receiverVal);
@@ -2166,7 +2164,7 @@ void GRExprEngine::VisitObjCMessageExprDispatchHelper(ObjCMessageExpr* ME,
NE = DstRValueConvert.end();
NI!=NE; ++NI) {
const GRState *state = GetState(*NI);
- EvalLoad(Dst, ME, *NI, state, state->getExprVal(ME),
+ EvalLoad(Dst, ME, *NI, state, state->getSVal(ME),
&ConvertToRvalueTag, LoadTy);
}
}
@@ -2214,7 +2212,7 @@ void GRExprEngine::VisitCast(CastExpr *CastE, Expr *Ex, ExplodedNode *Pred,
// Copy the SVal of Ex to CastE.
ExplodedNode *N = *I;
const GRState *state = GetState(N);
- SVal V = state->getExprVal(Ex);
+ SVal V = state->getSVal(Ex);
state = state->BindExpr(CastE, V);
MakeNode(Dst, CastE, N, state);
}
@@ -2236,7 +2234,7 @@ void GRExprEngine::VisitCast(CastExpr *CastE, Expr *Ex, ExplodedNode *Pred,
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
ExplodedNode* N = *I;
const GRState* state = GetState(N);
- SVal V = state->getExprVal(Ex);
+