summaryrefslogtreecommitdiff
path: root/clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp')
-rw-r--r--clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp b/clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp
index 701da7c..d95366d 100644
--- a/clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp
+++ b/clang/include/clang/Analysis/Analyses/IntervalSolver/EquationSystem.hpp
@@ -91,22 +91,18 @@ struct EquationSystem {
void indexMaxExpressions() {
_expr_to_var = new IdMap<MaxExpression<Domain>,Variable<Domain>*>(maxExpressionCount(), NULL);
for (unsigned int i = 0, length = _right_sides.size(); i < length; ++i) {
- _right_sides[i]->mapTo(*_variables[i], *_expr_to_var);
+ if (_right_sides[i])
+ _right_sides[i]->mapTo(*_variables[i], *_expr_to_var);
}
}
Variable<Domain>* varFromExpr(const Expression<Domain>& expr) const {
- if (_expr_to_var) { // we've indexed:
- const MaxExpression<Domain>* maxExpr = expr.toMaxExpression();//dynamic_cast<const MaxExpression<Domain>*>(&expr);
- if (maxExpr) {
- return (*_expr_to_var)[*maxExpr];
- } else {
- return NULL;
- }
+ assert(_expr_to_var != NULL); // ensure we've indexed
+ const MaxExpression<Domain>* maxExpr = expr.toMaxExpression();//dynamic_cast<const MaxExpression<Domain>*>(&expr);
+ if (maxExpr) {
+ return (*_expr_to_var)[*maxExpr];
} else {
- std::cout << "throw exception" << *(char*)NULL;
return NULL;
- //throw "Must index max expressions before attempting lookup";
}
}
@@ -125,7 +121,10 @@ struct EquationSystem {
for (unsigned int i = 0, length = _variables.size();
i < length;
++i) {
- cout << *_variables[i] << " = " << *_right_sides[i] << std::endl;
+ if (_right_sides[i])
+ cout << *_variables[i] << " = " << *_right_sides[i] << std::endl;
+ else
+ cout << *_variables[i] << " = NULL" << std::endl;
}
}