about summary refs log tree commit diff homepage
path: root/lib/Expr/Assignment.cpp
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2019-07-31 20:31:21 +0100
committerMartinNowack <martin.nowack@gmail.com>2019-08-01 09:27:03 +0100
commit7640a09981b6376da2ec75be7caf76661ef15f28 (patch)
tree99a392c744a981e312f8bc69c1a98942d9db1a05 /lib/Expr/Assignment.cpp
parent5732990c805948249bdc3d43a52cfe050ad66a95 (diff)
downloadklee-7640a09981b6376da2ec75be7caf76661ef15f28.tar.gz
Renamed misspelled file
Diffstat (limited to 'lib/Expr/Assignment.cpp')
-rw-r--r--lib/Expr/Assignment.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Expr/Assignment.cpp b/lib/Expr/Assignment.cpp
new file mode 100644
index 00000000..2fc569cc
--- /dev/null
+++ b/lib/Expr/Assignment.cpp
@@ -0,0 +1,44 @@
+//===-- Assignment.cpp ----------------------------------------------------===//
+//
+//                     The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "klee/Expr/Assignment.h"
+
+namespace klee {
+
+void Assignment::dump() {
+  if (bindings.size() == 0) {
+    llvm::errs() << "No bindings\n";
+    return;
+  }
+  for (bindings_ty::iterator i = bindings.begin(), e = bindings.end(); i != e;
+       ++i) {
+    llvm::errs() << (*i).first->name << "\n[";
+    for (int j = 0, k = (*i).second.size(); j < k; ++j)
+      llvm::errs() << (int)(*i).second[j] << ",";
+    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())));
+    }
+  }
+}
+}