diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-03-23 01:21:29 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-03-23 01:21:29 +0000 |
commit | a339cd66be6202c6e86916f52a347d0289bf2eea (patch) | |
tree | ab3a511a6556604903053ebc087ea813fa993b09 /lib/StaticAnalyzer/Core/SVals.cpp | |
parent | e30024c96f88578fb7666d6d76977e4834127919 (diff) |
[analyzer] Loc-Loc operations (subtraction or comparison) produce a NonLoc.
For two concrete locations, we were producing another concrete location and
then casting it to an integer. We should just create a nonloc::ConcreteInt
to begin with.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SVals.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SVals.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp index da52a90ec5..38e216f28c 100644 --- a/lib/StaticAnalyzer/Core/SVals.cpp +++ b/lib/StaticAnalyzer/Core/SVals.cpp @@ -214,13 +214,12 @@ SVal loc::ConcreteInt::evalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op, const loc::ConcreteInt& R) const { - assert (Op == BO_Add || Op == BO_Sub || - (Op >= BO_LT && Op <= BO_NE)); + assert(BinaryOperator::isComparisonOp(Op) || Op == BO_Sub); - const llvm::APSInt* X = BasicVals.evalAPSInt(Op, getValue(), R.getValue()); + const llvm::APSInt *X = BasicVals.evalAPSInt(Op, getValue(), R.getValue()); if (X) - return loc::ConcreteInt(*X); + return nonloc::ConcreteInt(*X); else return UndefinedVal(); } |