forked from OSchip/llvm-project
parent
396b9c380a
commit
3070210377
|
@ -362,7 +362,7 @@ public:
|
||||||
|
|
||||||
namespace loc {
|
namespace loc {
|
||||||
|
|
||||||
enum Kind { GotoLabelKind, MemRegionKind, FuncValKind, ConcreteIntKind };
|
enum Kind { GotoLabelKind, MemRegionKind, ConcreteIntKind };
|
||||||
|
|
||||||
class GotoLabel : public Loc {
|
class GotoLabel : public Loc {
|
||||||
public:
|
public:
|
||||||
|
@ -415,33 +415,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FuncVal : public Loc {
|
|
||||||
public:
|
|
||||||
FuncVal(const FunctionDecl* fd) : Loc(FuncValKind, fd) {}
|
|
||||||
|
|
||||||
FunctionDecl* getDecl() const {
|
|
||||||
return static_cast<FunctionDecl*>(Data);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator==(const FuncVal& R) const {
|
|
||||||
return getDecl() == R.getDecl();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator!=(const FuncVal& R) const {
|
|
||||||
return getDecl() != R.getDecl();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implement isa<T> support.
|
|
||||||
static inline bool classof(const SVal* V) {
|
|
||||||
return V->getBaseKind() == LocKind &&
|
|
||||||
V->getSubKind() == FuncValKind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool classof(const Loc* V) {
|
|
||||||
return V->getSubKind() == FuncValKind;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ConcreteInt : public Loc {
|
class ConcreteInt : public Loc {
|
||||||
public:
|
public:
|
||||||
ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
|
ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
|
||||||
|
|
|
@ -200,8 +200,6 @@ SVal BasicStoreManager::getLValueField(const GRState* St, SVal Base,
|
||||||
|
|
||||||
switch(BaseL.getSubKind()) {
|
switch(BaseL.getSubKind()) {
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
case loc::FuncValKind:
|
|
||||||
// Technically we can get here if people do funny things with casts.
|
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
|
|
||||||
case loc::MemRegionKind:
|
case loc::MemRegionKind:
|
||||||
|
@ -234,7 +232,6 @@ SVal BasicStoreManager::getLValueElement(const GRState* St, SVal Base,
|
||||||
|
|
||||||
switch(BaseL.getSubKind()) {
|
switch(BaseL.getSubKind()) {
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
case loc::FuncValKind:
|
|
||||||
// Technically we can get here if people do funny things with casts.
|
// Technically we can get here if people do funny things with casts.
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
|
|
||||||
|
@ -338,8 +335,6 @@ SVal BasicStoreManager::Retrieve(const GRState* state, Loc loc, QualType T) {
|
||||||
// they are doing a quick scan through their Locs (potentially to
|
// they are doing a quick scan through their Locs (potentially to
|
||||||
// invalidate their bindings). Just return Undefined.
|
// invalidate their bindings). Just return Undefined.
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
case loc::FuncValKind:
|
|
||||||
return loc;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert (false && "Invalid Loc.");
|
assert (false && "Invalid Loc.");
|
||||||
|
|
|
@ -307,7 +307,6 @@ SVal GRSimpleVals::EvalEQ(GRExprEngine& Eng, Loc L, Loc R) {
|
||||||
|
|
||||||
// Fall-through.
|
// Fall-through.
|
||||||
|
|
||||||
case loc::FuncValKind:
|
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
return NonLoc::MakeIntTruthVal(BasicVals, L == R);
|
return NonLoc::MakeIntTruthVal(BasicVals, L == R);
|
||||||
}
|
}
|
||||||
|
@ -356,7 +355,6 @@ SVal GRSimpleVals::EvalNE(GRExprEngine& Eng, Loc L, Loc R) {
|
||||||
// Fall through:
|
// Fall through:
|
||||||
}
|
}
|
||||||
|
|
||||||
case loc::FuncValKind:
|
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
return NonLoc::MakeIntTruthVal(BasicVals, L != R);
|
return NonLoc::MakeIntTruthVal(BasicVals, L != R);
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,7 +365,6 @@ SVal RegionStoreManager::getLValueFieldOrIvar(const GRState* St, SVal Base,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
case loc::FuncValKind:
|
|
||||||
// These are anormal cases. Flag an undefined value.
|
// These are anormal cases. Flag an undefined value.
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
|
|
||||||
|
@ -662,11 +661,6 @@ SVal RegionStoreManager::Retrieve(const GRState* St, Loc L, QualType T) {
|
||||||
if (isa<loc::ConcreteInt>(L))
|
if (isa<loc::ConcreteInt>(L))
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
|
|
||||||
// FIXME: Should this be refactored into GRExprEngine or GRStateManager?
|
|
||||||
// It seems that all StoreManagers would do the same thing here.
|
|
||||||
if (isa<loc::FuncVal>(L))
|
|
||||||
return L;
|
|
||||||
|
|
||||||
const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion();
|
const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion();
|
||||||
|
|
||||||
// We return unknown for symbolic region for now. This might be improved.
|
// We return unknown for symbolic region for now. This might be improved.
|
||||||
|
|
|
@ -31,10 +31,6 @@ using llvm::APSInt;
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
const FunctionDecl* SVal::getAsFunctionDecl() const {
|
const FunctionDecl* SVal::getAsFunctionDecl() const {
|
||||||
if (const loc::FuncVal* FV = dyn_cast<loc::FuncVal>(this)) {
|
|
||||||
return FV->getDecl();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
|
if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
|
||||||
const MemRegion* R = X->getRegion();
|
const MemRegion* R = X->getRegion();
|
||||||
if (const CodeTextRegion* CTR = dyn_cast<CodeTextRegion>(R)) {
|
if (const CodeTextRegion* CTR = dyn_cast<CodeTextRegion>(R)) {
|
||||||
|
@ -481,11 +477,6 @@ void Loc::print(llvm::raw_ostream& Out) const {
|
||||||
Out << '&' << cast<loc::MemRegionVal>(this)->getRegion()->getString();
|
Out << '&' << cast<loc::MemRegionVal>(this)->getRegion()->getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case loc::FuncValKind:
|
|
||||||
Out << "function "
|
|
||||||
<< cast<loc::FuncVal>(this)->getDecl()->getIdentifier()->getName();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert (false && "Pretty-printing not implemented for this Loc.");
|
assert (false && "Pretty-printing not implemented for this Loc.");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -116,7 +116,6 @@ SimpleConstraintManager::AssumeAux(const GRState* St, Loc Cond, bool Assumption,
|
||||||
// FALL-THROUGH.
|
// FALL-THROUGH.
|
||||||
}
|
}
|
||||||
|
|
||||||
case loc::FuncValKind:
|
|
||||||
case loc::GotoLabelKind:
|
case loc::GotoLabelKind:
|
||||||
isFeasible = Assumption;
|
isFeasible = Assumption;
|
||||||
return St;
|
return St;
|
||||||
|
|
Loading…
Reference in New Issue