From 4d57a5a829124106a4ef81e5131a50d1e7caed7f Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 22 Feb 2016 19:10:39 +0000 Subject: Move Array constructor out of ``Expr.h`` and into ``Expr.cpp``. The implementation of the constructor calls a method on a ``ConstantExpr`` which means the type must be complete (i.e. a forward declaration of ``ConstantExpr`` is insufficient) which creates an unnecessary ordering Dependency in ``Expr.h``. --- lib/Expr/Expr.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 2c64aff4..ccd757af 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -483,6 +483,24 @@ ref NotOptimizedExpr::create(ref src) { extern "C" void vc_DeleteExpr(void*); +Array::Array(const std::string &_name, uint64_t _size, + const ref *constantValuesBegin, + const ref *constantValuesEnd, Expr::Width _domain, + Expr::Width _range) + : name(_name), size(_size), domain(_domain), range(_range), + constantValues(constantValuesBegin, constantValuesEnd) { + + assert((isSymbolicArray() || constantValues.size() == size) && + "Invalid size for constant array!"); + computeHash(); +#ifndef NDEBUG + for (const ref *it = constantValuesBegin; + it != constantValuesEnd; ++it) + assert((*it)->getWidth() == getRange() && + "Invalid initial constant value!"); +#endif // NDEBUG +} + Array::~Array() { } -- cgit 1.4.1 From 7f67a03988b6c0c5976d8b0aceb5406fd858c216 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 22 Feb 2016 19:13:12 +0000 Subject: Remove stray STP function declaration. --- lib/Expr/Expr.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib') diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index ccd757af..182093b9 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -481,8 +481,6 @@ ref NotOptimizedExpr::create(ref src) { /***/ -extern "C" void vc_DeleteExpr(void*); - Array::Array(const std::string &_name, uint64_t _size, const ref *constantValuesBegin, const ref *constantValuesEnd, Expr::Width _domain, -- cgit 1.4.1 From 238998f8e17b554d0c28931a61271619310a098f Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 23 Feb 2016 17:21:42 +0000 Subject: Move ``Assignment::dump()`` into its own implementation file so that it's possible to call it from gdb. --- include/klee/util/Assignment.h | 10 +--------- lib/Expr/Assigment.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 lib/Expr/Assigment.cpp (limited to 'lib') diff --git a/include/klee/util/Assignment.h b/include/klee/util/Assignment.h index e7478d33..5d8aa1ab 100644 --- a/include/klee/util/Assignment.h +++ b/include/klee/util/Assignment.h @@ -49,15 +49,7 @@ namespace klee { template bool satisfies(InputIterator begin, InputIterator end); - - void dump() { - 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(); jname << "\n["; + for (int j = 0, k = (*i).second.size(); j < k; ++j) + llvm::errs() << (int)(*i).second[j] << ","; + llvm::errs() << "]\n"; + } +} +} -- cgit 1.4.1 From 9bc1d11162403e331e99d5d0494feab70ace6fbc Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 23 Feb 2016 17:25:07 +0000 Subject: When calling ``Assignment::dump()`` if there are no bindings emit a message stating this. --- lib/Expr/Assigment.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/Expr/Assigment.cpp b/lib/Expr/Assigment.cpp index 900c6d10..635362d4 100644 --- a/lib/Expr/Assigment.cpp +++ b/lib/Expr/Assigment.cpp @@ -10,6 +10,10 @@ 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["; -- cgit 1.4.1