From a1b73df93e5a2fac4a7ac87fb1753c4eb518c8c0 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Wed, 27 Mar 2019 11:33:07 +0000 Subject: Separate constraint set and constraint manager --- lib/Expr/Assignment.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/Expr/Assignment.cpp') diff --git a/lib/Expr/Assignment.cpp b/lib/Expr/Assignment.cpp index 2fc569cc..98b92337 100644 --- a/lib/Expr/Assignment.cpp +++ b/lib/Expr/Assignment.cpp @@ -25,20 +25,20 @@ void Assignment::dump() { } } -void Assignment::createConstraintsFromAssignment( - std::vector > &out) const { - assert(out.size() == 0 && "out should be empty"); - for (bindings_ty::const_iterator it = bindings.begin(), ie = bindings.end(); - it != ie; ++it) { - const Array *array = it->first; - const std::vector &values = it->second; +ConstraintSet Assignment::createConstraintsFromAssignment() const { + ConstraintSet result; + for (const auto &binding : bindings) { + const auto &array = binding.first; + const auto &values = binding.second; + for (unsigned arrayIndex = 0; arrayIndex < array->size; ++arrayIndex) { unsigned char value = values[arrayIndex]; - out.push_back(EqExpr::create( + result.push_back(EqExpr::create( ReadExpr::create(UpdateList(array, 0), ConstantExpr::alloc(arrayIndex, array->getDomain())), ConstantExpr::alloc(value, array->getRange()))); } } + return result; } } -- cgit 1.4.1