File tree 3 files changed +53
-2
lines changed 3 files changed +53
-2
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ bvt boolbvt::conversion_failed(const exprt &expr)
152
152
return prop.new_variables (width);
153
153
}
154
154
155
+ // / TODO
156
+ // / \param expr: TODO
157
+ // / \return TODO
158
+ // / \throws bitvector_conversion_exceptiont raised if converting byte_extraction
159
+ // / goes wrong. TODO: extend for other types of conversion exception).
155
160
bvt boolbvt::convert_bitvector (const exprt &expr)
156
161
{
157
162
if (expr.type ().id ()==ID_bool)
Original file line number Diff line number Diff line change 16
16
#include < util/endianness_map.h>
17
17
18
18
#include " flatten_byte_operators.h"
19
+ #include " flatten_byte_extract_exceptions.h"
20
+ #include " bv_conversion_exceptions.h"
19
21
20
22
bvt map_bv (const endianness_mapt &map, const bvt &src)
21
23
{
@@ -42,8 +44,16 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
42
44
// if we extract from an unbounded array, call the flattening code
43
45
if (is_unbounded_array (expr.op ().type ()))
44
46
{
45
- exprt tmp=flatten_byte_extract (expr, ns);
46
- return convert_bv (tmp);
47
+ try
48
+ {
49
+ exprt tmp = flatten_byte_extract (expr, ns);
50
+ return convert_bv (tmp);
51
+ }
52
+ catch (const flatten_byte_extract_exceptiont &byte_extract_flatten_exception)
53
+ {
54
+ std::throw_with_nested (
55
+ bitvector_conversion_exceptiont (" Can't convert byte_extraction" , expr));
56
+ }
47
57
}
48
58
49
59
std::size_t width=boolbv_width (expr.type ());
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Bit vector conversion
4
+
5
+ Author: Diffblue Ltd.
6
+
7
+ \*******************************************************************/
8
+
9
+ // / \file
10
+ // / Exceptions that can be raised in bv_conversion
11
+
12
+ #ifndef CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
13
+ #define CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
14
+
15
+ #include " flatten_byte_extract_exceptions.h"
16
+ #include " flatten_byte_operators.h"
17
+ #include < util/endianness_map.h>
18
+ #include < util/arith_tools.h>
19
+ #include " boolbv.h"
20
+ #include " bv_conversion_exceptions.h"
21
+
22
+ class bitvector_conversion_exceptiont : public std ::runtime_error
23
+ {
24
+ public:
25
+ bitvector_conversion_exceptiont (
26
+ const std::string &exception_message,
27
+ const exprt &bv_expr)
28
+ : runtime_error(exception_message), bv_expr(bv_expr)
29
+ {
30
+ }
31
+
32
+ private:
33
+ exprt bv_expr;
34
+ };
35
+
36
+ #endif // CPROVER_SOLVERS_FLATTENING_BV_CONVERSION_EXCEPTIONS_H
You can’t perform that action at this time.
0 commit comments