summaryrefslogtreecommitdiff
path: root/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-11-01 18:06:13 +1100
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-11-01 18:06:13 +1100
commitb7eaa99578037789a337c5061c0ea8ee3150b63c (patch)
treee63a023a85ef167760f55229c1d96fbcaaa1c64e /clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp
parente207a8fec1bae01068bdb3a27a2090a4af5f8cb2 (diff)
A bunch of fixes to the solver, and moving it in to clang.
Also some contribution writing stuff. Basically: lots of work.
Diffstat (limited to 'clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp')
-rw-r--r--clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp b/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp
index 08c66ff..64ef096 100644
--- a/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp
+++ b/clang/include/clang/Analysis/Analyses/IntervalSolver/Operator.hpp
@@ -1,6 +1,7 @@
#ifndef OPERATOR_HPP
#define OPERATOR_HPP
+#include <cassert>
#include <vector>
template<typename Domain>
@@ -28,11 +29,6 @@ struct Maximum : public Operator<Domain> {
}
};
-
-template<class T>
-T minimum(const T& l, const T& r) {
- return (l < r ? l : r);
-}
template<typename Domain>
struct Minimum : public Operator<Domain> {
virtual Domain eval(const std::vector<Domain>& arguments) const {
@@ -40,7 +36,7 @@ struct Minimum : public Operator<Domain> {
for (typename std::vector<Domain>::const_iterator it = arguments.begin();
it != arguments.end();
++it) {
- result = minimum(*it, result); //*it < result ? *it : result);
+ result = (*it < result ? *it : result);
}
return result;
}
@@ -52,8 +48,7 @@ struct Minimum : public Operator<Domain> {
template<typename Domain>
struct Negation : public Operator<Domain> {
virtual Domain eval(const std::vector<Domain>& arguments) const {
- if (arguments.size() > 1)
- throw "Too many arguments to a negation.";
+ assert(arguments.size() == 1);
return -arguments[0];
}
void print(std::ostream& cout) const {