diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-03-23 01:21:20 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-03-23 01:21:20 +0000 |
commit | 8569281fb7ce9b5ca164a0528b876acbb45eb989 (patch) | |
tree | 1277cb6f93d94083db7efa3372871f182d244e2d /lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp | |
parent | 78114a58f8cf5e9b948e82448b2f0904f5b6c19e (diff) |
Add reverseComparisonOp and negateComparisonOp to BinaryOperator.
...and adopt them in the analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp index 86940a1e84..d87c51fed3 100644 --- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -124,21 +124,6 @@ ProgramStateRef SimpleConstraintManager::assume(ProgramStateRef state, return state; } -static BinaryOperator::Opcode NegateComparison(BinaryOperator::Opcode op) { - // FIXME: This should probably be part of BinaryOperator, since this isn't - // the only place it's used. (This code was copied from SimpleSValBuilder.cpp.) - switch (op) { - default: - llvm_unreachable("Invalid opcode."); - case BO_LT: return BO_GE; - case BO_GT: return BO_LE; - case BO_LE: return BO_GT; - case BO_GE: return BO_LT; - case BO_EQ: return BO_NE; - case BO_NE: return BO_EQ; - } -} - ProgramStateRef SimpleConstraintManager::assumeAuxForSymbol(ProgramStateRef State, @@ -189,7 +174,7 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef state, BinaryOperator::Opcode op = SE->getOpcode(); if (BinaryOperator::isComparisonOp(op)) { if (!Assumption) - op = NegateComparison(op); + op = BinaryOperator::negateComparisonOp(op); return assumeSymRel(state, SE->getLHS(), op, SE->getRHS()); } |