diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-01-07 09:19:21 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-01-07 09:21:42 +0000 |
commit | f651a4aaca1a12f7f481c0c43a16f3e26485164f (patch) | |
tree | e8c2be58a794b4f1d41862005c67027a575612d6 | |
parent | 34829f7444038a254449702082e7852f9ae1cad7 (diff) | |
download | klee-f651a4aaca1a12f7f481c0c43a16f3e26485164f.tar.gz |
[NFC] Refactor SolverImpl out of Solver.cpp into its own file
(SolverImpl.cpp). Whilst I'm here also clang-format the modified code.
-rw-r--r-- | lib/Solver/Solver.cpp | 46 | ||||
-rw-r--r-- | lib/Solver/SolverImpl.cpp | 52 |
2 files changed, 52 insertions, 46 deletions
diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp index 6f4bbc5b..30424526 100644 --- a/lib/Solver/Solver.cpp +++ b/lib/Solver/Solver.cpp @@ -69,52 +69,6 @@ using namespace metaSMT::solver; #endif /* SUPPORT_METASMT */ - - -/***/ - -SolverImpl::~SolverImpl() { -} - -bool SolverImpl::computeValidity(const Query& query, Solver::Validity &result) { - bool isTrue, isFalse; - if (!computeTruth(query, isTrue)) - return false; - if (isTrue) { - result = Solver::True; - } else { - if (!computeTruth(query.negateExpr(), isFalse)) - return false; - result = isFalse ? Solver::False : Solver::Unknown; - } - return true; -} - -const char* SolverImpl::getOperationStatusString(SolverRunStatus statusCode) -{ - switch (statusCode) - { - case SOLVER_RUN_STATUS_SUCCESS_SOLVABLE: - return "OPERATION SUCCESSFUL, QUERY IS SOLVABLE"; - case SOLVER_RUN_STATUS_SUCCESS_UNSOLVABLE: - return "OPERATION SUCCESSFUL, QUERY IS UNSOLVABLE"; - case SOLVER_RUN_STATUS_FAILURE: - return "OPERATION FAILED"; - case SOLVER_RUN_STATUS_TIMEOUT: - return "SOLVER TIMEOUT"; - case SOLVER_RUN_STATUS_FORK_FAILED: - return "FORK FAILED"; - case SOLVER_RUN_STATUS_INTERRUPTED: - return "SOLVER PROCESS INTERRUPTED"; - case SOLVER_RUN_STATUS_UNEXPECTED_EXIT_CODE: - return "UNEXPECTED SOLVER PROCESS EXIT CODE"; - case SOLVER_RUN_STATUS_WAITPID_FAILED: - return "WAITPID FAILED FOR SOLVER PROCESS"; - default: - return "UNRECOGNIZED OPERATION STATUS"; - } -} - const char *Solver::validity_to_str(Validity v) { switch (v) { default: return "Unknown"; diff --git a/lib/Solver/SolverImpl.cpp b/lib/Solver/SolverImpl.cpp new file mode 100644 index 00000000..e8f30c9e --- /dev/null +++ b/lib/Solver/SolverImpl.cpp @@ -0,0 +1,52 @@ +//===-- SolverImpl.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/Solver.h" +#include "klee/SolverImpl.h" + +using namespace klee; + +SolverImpl::~SolverImpl() {} + +bool SolverImpl::computeValidity(const Query &query, Solver::Validity &result) { + bool isTrue, isFalse; + if (!computeTruth(query, isTrue)) + return false; + if (isTrue) { + result = Solver::True; + } else { + if (!computeTruth(query.negateExpr(), isFalse)) + return false; + result = isFalse ? Solver::False : Solver::Unknown; + } + return true; +} + +const char *SolverImpl::getOperationStatusString(SolverRunStatus statusCode) { + switch (statusCode) { + case SOLVER_RUN_STATUS_SUCCESS_SOLVABLE: + return "OPERATION SUCCESSFUL, QUERY IS SOLVABLE"; + case SOLVER_RUN_STATUS_SUCCESS_UNSOLVABLE: + return "OPERATION SUCCESSFUL, QUERY IS UNSOLVABLE"; + case SOLVER_RUN_STATUS_FAILURE: + return "OPERATION FAILED"; + case SOLVER_RUN_STATUS_TIMEOUT: + return "SOLVER TIMEOUT"; + case SOLVER_RUN_STATUS_FORK_FAILED: + return "FORK FAILED"; + case SOLVER_RUN_STATUS_INTERRUPTED: + return "SOLVER PROCESS INTERRUPTED"; + case SOLVER_RUN_STATUS_UNEXPECTED_EXIT_CODE: + return "UNEXPECTED SOLVER PROCESS EXIT CODE"; + case SOLVER_RUN_STATUS_WAITPID_FAILED: + return "WAITPID FAILED FOR SOLVER PROCESS"; + default: + return "UNRECOGNIZED OPERATION STATUS"; + } +} |