diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-09-15 12:09:23 +0100 |
---|---|---|
committer | Dan Liew <delcypher@gmail.com> | 2017-03-23 21:46:41 +0000 |
commit | 4530447c21353b5596b66a9fbb642409cda56f73 (patch) | |
tree | 094a516168e39166898887984cdb2cbed6762965 /lib/Expr | |
parent | a40818cab8e1b2315ac40d2c2cb125fc422e8ed7 (diff) | |
download | klee-4530447c21353b5596b66a9fbb642409cda56f73.tar.gz |
Add `AssignmentValidatingSolver`. It's purpose is to check any computed
assignments against the corresponding `Query` object and check the assignment evaluates correctly. This can be switched on using `-debug-assignment-validating-solver` on the command line.
Diffstat (limited to 'lib/Expr')
-rw-r--r-- | lib/Expr/Assigment.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Expr/Assigment.cpp b/lib/Expr/Assigment.cpp index 635362d4..d788785a 100644 --- a/lib/Expr/Assigment.cpp +++ b/lib/Expr/Assigment.cpp @@ -22,4 +22,21 @@ void Assignment::dump() { llvm::errs() << "]\n"; } } + +void Assignment::createConstraintsFromAssignment( + std::vector<ref<Expr> > &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<unsigned char> &values = it->second; + for (unsigned arrayIndex = 0; arrayIndex < array->size; ++arrayIndex) { + unsigned char value = values[arrayIndex]; + out.push_back(EqExpr::create( + ReadExpr::create(UpdateList(array, 0), + ConstantExpr::alloc(arrayIndex, array->getDomain())), + ConstantExpr::alloc(value, array->getRange()))); + } + } +} } |