|
| 1 | +/*******************************************************************\ |
| 2 | +
|
| 3 | +Module: Symbolic Execution |
| 4 | +
|
| 5 | +Author: Diffblue Ltd. |
| 6 | +
|
| 7 | +\*******************************************************************/ |
| 8 | + |
| 9 | +/// \file |
| 10 | +/// Exceptions that can be raised during the equation conversion phase |
| 11 | + |
| 12 | +#ifndef CPROVER_GOTO_SYMEX_EQUATION_CONVERSION_EXCEPTIONS_H |
| 13 | +#define CPROVER_GOTO_SYMEX_EQUATION_CONVERSION_EXCEPTIONS_H |
| 14 | + |
| 15 | +#include <ostream> |
| 16 | +#include <util/namespace.h> |
| 17 | +#include "symex_target_equation.h" |
| 18 | + |
| 19 | +class guard_conversion_exceptiont : public std::runtime_error |
| 20 | +{ |
| 21 | +public: |
| 22 | + guard_conversion_exceptiont( |
| 23 | + const symex_target_equationt::SSA_stept &step, |
| 24 | + const namespacet &ns) : |
| 25 | + runtime_error("Error converting guard for step"), step(step) |
| 26 | + { |
| 27 | + std::ostringstream error_msg; |
| 28 | + error_msg << runtime_error::what(); |
| 29 | + error_msg << "\nStep:\n"; |
| 30 | + step.output(ns, error_msg); |
| 31 | + error_message = error_msg.str(); |
| 32 | + } |
| 33 | + |
| 34 | + guard_conversion_exceptiont( |
| 35 | + const symex_target_equationt::SSA_stept &step) : |
| 36 | + guard_conversion_exceptiont(step, namespacet{symbol_tablet{}}) |
| 37 | + { |
| 38 | + } |
| 39 | + |
| 40 | + const char *what() const noexcept override |
| 41 | + { |
| 42 | + return error_message.c_str(); |
| 43 | + } |
| 44 | + |
| 45 | +private: |
| 46 | + symex_target_equationt::SSA_stept step; |
| 47 | + std::string error_message; |
| 48 | +}; |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +#endif //CPROVER_GOTO_SYMEX_EQUATION_CONVERSION_EXCEPTIONS_H |
0 commit comments