diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index c3750b2320c8..69f19f7d8565 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h @@ -331,11 +331,6 @@ public: return *static_cast(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; } diff --git a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp index f5e4b176c5dd..754699ac8898 100644 --- a/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -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().evalMinus(*this); + return makeIntVal(-X.castAs().getValue()); case nonloc::SymbolValKind: - return makeNonLoc(val.castAs().getSymbol(), UO_Minus, - val.getType(Context)); + return makeNonLoc(X.castAs().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().evalComplement(*this); + return makeIntVal(~X.castAs().getValue()); case nonloc::SymbolValKind: return makeNonLoc(X.castAs().getSymbol(), UO_Not, X.getType(Context)); diff --git a/clang/lib/StaticAnalyzer/Core/SVals.cpp b/clang/lib/StaticAnalyzer/Core/SVals.cpp index 1429d36107e9..67913a55b3dc 100644 --- a/clang/lib/StaticAnalyzer/Core/SVals.cpp +++ b/clang/lib/StaticAnalyzer/Core/SVals.cpp @@ -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. //===----------------------------------------------------------------------===//