forked from OSchip/llvm-project
[analyzer][NFC] Substitute the SVal::evalMinus and evalComplement functions
Depends on D126127 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127734
This commit is contained in:
parent
cfc915149c
commit
40940fb2a6
|
@ -331,11 +331,6 @@ public:
|
|||
return *static_cast<const llvm::APSInt *>(Data);
|
||||
}
|
||||
|
||||
// Transfer functions for unary operations on ConcreteInts.
|
||||
ConcreteInt evalComplement(SValBuilder &svalBuilder) const;
|
||||
|
||||
ConcreteInt evalMinus(SValBuilder &svalBuilder) const;
|
||||
|
||||
static bool classof(SVal V) {
|
||||
return V.getBaseKind() == NonLocKind && V.getSubKind() == ConcreteIntKind;
|
||||
}
|
||||
|
|
|
@ -441,13 +441,13 @@ SVal SValBuilder::makeSymExprValNN(BinaryOperator::Opcode Op,
|
|||
return UnknownVal();
|
||||
}
|
||||
|
||||
SVal SValBuilder::evalMinus(NonLoc val) {
|
||||
switch (val.getSubKind()) {
|
||||
SVal SValBuilder::evalMinus(NonLoc X) {
|
||||
switch (X.getSubKind()) {
|
||||
case nonloc::ConcreteIntKind:
|
||||
return val.castAs<nonloc::ConcreteInt>().evalMinus(*this);
|
||||
return makeIntVal(-X.castAs<nonloc::ConcreteInt>().getValue());
|
||||
case nonloc::SymbolValKind:
|
||||
return makeNonLoc(val.castAs<nonloc::SymbolVal>().getSymbol(), UO_Minus,
|
||||
val.getType(Context));
|
||||
return makeNonLoc(X.castAs<nonloc::SymbolVal>().getSymbol(), UO_Minus,
|
||||
X.getType(Context));
|
||||
default:
|
||||
return UnknownVal();
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ SVal SValBuilder::evalMinus(NonLoc val) {
|
|||
SVal SValBuilder::evalComplement(NonLoc X) {
|
||||
switch (X.getSubKind()) {
|
||||
case nonloc::ConcreteIntKind:
|
||||
return X.castAs<nonloc::ConcreteInt>().evalComplement(*this);
|
||||
return makeIntVal(~X.castAs<nonloc::ConcreteInt>().getValue());
|
||||
case nonloc::SymbolValKind:
|
||||
return makeNonLoc(X.castAs<nonloc::SymbolVal>().getSymbol(), UO_Not,
|
||||
X.getType(Context));
|
||||
|
|
|
@ -252,20 +252,6 @@ bool SVal::isZeroConstant() const {
|
|||
return isConstant(0);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Transfer function dispatch for Non-Locs.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
nonloc::ConcreteInt
|
||||
nonloc::ConcreteInt::evalComplement(SValBuilder &svalBuilder) const {
|
||||
return svalBuilder.makeIntVal(~getValue());
|
||||
}
|
||||
|
||||
nonloc::ConcreteInt
|
||||
nonloc::ConcreteInt::evalMinus(SValBuilder &svalBuilder) const {
|
||||
return svalBuilder.makeIntVal(-getValue());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Pretty-Printing.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue