aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/SimpleConstraintManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/SimpleConstraintManager.cpp')
-rw-r--r--lib/Analysis/SimpleConstraintManager.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/Analysis/SimpleConstraintManager.cpp b/lib/Analysis/SimpleConstraintManager.cpp
index 82801eb05d..db3d68a2c7 100644
--- a/lib/Analysis/SimpleConstraintManager.cpp
+++ b/lib/Analysis/SimpleConstraintManager.cpp
@@ -23,10 +23,10 @@ SimpleConstraintManager::~SimpleConstraintManager() {}
bool SimpleConstraintManager::canReasonAbout(SVal X) const {
if (nonloc::SymExprVal *SymVal = dyn_cast<nonloc::SymExprVal>(&X)) {
const SymExpr *SE = SymVal->getSymbolicExpression();
-
+
if (isa<SymbolData>(SE))
return true;
-
+
if (const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SE)) {
switch (SIE->getOpcode()) {
// We don't reason yet about bitwise-constraints on symbolic values.
@@ -46,7 +46,7 @@ bool SimpleConstraintManager::canReasonAbout(SVal X) const {
// All other cases.
default:
return true;
- }
+ }
}
return false;
@@ -54,7 +54,7 @@ bool SimpleConstraintManager::canReasonAbout(SVal X) const {
return true;
}
-
+
const GRState *SimpleConstraintManager::Assume(const GRState *state,
SVal Cond, bool Assumption) {
if (Cond.isUnknown()) {
@@ -74,14 +74,14 @@ const GRState *SimpleConstraintManager::Assume(const GRState *state, Loc Cond,
// EvalAssume is used to call into the GRTransferFunction object to perform
// any checker-specific update of the state based on this assumption being
- // true or false.
+ // true or false.
return state ? state->getTransferFuncs().EvalAssume(state, Cond, Assumption)
: NULL;
}
const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
Loc Cond, bool Assumption) {
-
+
BasicValueFactory &BasicVals = state->getBasicVals();
switch (Cond.getSubKind()) {
@@ -91,7 +91,7 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
case loc::MemRegionKind: {
// FIXME: Should this go into the storemanager?
-
+
const MemRegion *R = cast<loc::MemRegionVal>(Cond).getRegion();
const SubRegion *SubR = dyn_cast<SubRegion>(R);
@@ -99,7 +99,7 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
// FIXME: now we only find the first symbolic region.
if (const SymbolicRegion *SymR = dyn_cast<SymbolicRegion>(SubR)) {
if (Assumption)
- return AssumeSymNE(state, SymR->getSymbol(),
+ return AssumeSymNE(state, SymR->getSymbol(),
BasicVals.getZeroWithPtrWidth());
else
return AssumeSymEQ(state, SymR->getSymbol(),
@@ -107,15 +107,15 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
}
SubR = dyn_cast<SubRegion>(SubR->getSuperRegion());
}
-
+
// FALL-THROUGH.
}
-
+
case loc::GotoLabelKind:
return Assumption ? state : NULL;
case loc::ConcreteIntKind: {
- bool b = cast<loc::ConcreteInt>(Cond).getValue() != 0;
+ bool b = cast<loc::ConcreteInt>(Cond).getValue() != 0;
bool isFeasible = b ? Assumption : !Assumption;
return isFeasible ? state : NULL;
}
@@ -130,7 +130,7 @@ const GRState *SimpleConstraintManager::Assume(const GRState *state,
// EvalAssume is used to call into the GRTransferFunction object to perform
// any checker-specific update of the state based on this assumption being
- // true or false.
+ // true or false.
return state ? state->getTransferFuncs().EvalAssume(state, Cond, Assumption)
: NULL;
}
@@ -138,13 +138,13 @@ const GRState *SimpleConstraintManager::Assume(const GRState *state,
const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
NonLoc Cond,
bool Assumption) {
-
+
// We cannot reason about SymIntExpr and SymSymExpr.
if (!canReasonAbout(Cond)) {
// Just return the current state indicating that the path is feasible.
// This may be an over-approximation of what is possible.
return state;
- }
+ }
BasicValueFactory &BasicVals = state->getBasicVals();
SymbolManager &SymMgr = state->getSymbolManager();
@@ -156,7 +156,7 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
case nonloc::SymbolValKind: {
nonloc::SymbolVal& SV = cast<nonloc::SymbolVal>(Cond);
SymbolRef sym = SV.getSymbol();
- QualType T = SymMgr.getType(sym);
+ QualType T = SymMgr.getType(sym);
const llvm::APSInt &zero = BasicVals.getValue(0, T);
return Assumption ? AssumeSymNE(state, sym, zero)
@@ -167,7 +167,7 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
nonloc::SymExprVal V = cast<nonloc::SymExprVal>(Cond);
if (const SymIntExpr *SE = dyn_cast<SymIntExpr>(V.getSymbolicExpression()))
return AssumeSymInt(state, Assumption, SE);
-
+
// For all other symbolic expressions, over-approximate and consider
// the constraint feasible.
return state;
@@ -194,7 +194,7 @@ const GRState *SimpleConstraintManager::AssumeSymInt(const GRState *state,
// rest of the constraint manager logic.
SymbolRef Sym = cast<SymbolData>(SE->getLHS());
const llvm::APSInt &Int = SE->getRHS();
-
+
switch (SE->getOpcode()) {
default:
// No logic yet for other operators. Assume the constraint is feasible.
@@ -218,7 +218,7 @@ const GRState *SimpleConstraintManager::AssumeSymInt(const GRState *state,
case BinaryOperator::LT:
return Assumption ? AssumeSymLT(state, Sym, Int)
: AssumeSymGE(state, Sym, Int);
-
+
case BinaryOperator::LE:
return Assumption ? AssumeSymLE(state, Sym, Int)
: AssumeSymGT(state, Sym, Int);
@@ -226,9 +226,9 @@ const GRState *SimpleConstraintManager::AssumeSymInt(const GRState *state,
}
const GRState *SimpleConstraintManager::AssumeInBound(const GRState *state,
- SVal Idx,
+ SVal Idx,
SVal UpperBound,
- bool Assumption) {
+ bool Assumption) {
// Only support ConcreteInt for now.
if (!(isa<nonloc::ConcreteInt>(Idx) && isa<nonloc::ConcreteInt>(UpperBound)))