Skip to content

Commit 1639e0f

Browse files
author
thk123
committed
Introduce formula conversion exception
1 parent 8a7ef67 commit 1639e0f

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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

src/goto-symex/symex_target_equation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Author: Daniel Kroening, kroening@kroening.com
2020
#include <solvers/flattening/bv_conversion_exceptions.h>
2121

2222
#include "goto_symex_state.h"
23+
#include "equation_conversion_exceptions.h"
2324

2425
/// read from a shared variable
2526
void symex_target_equationt::shared_read(

0 commit comments

Comments
 (0)