Skip to content

Commit 4e29f7e

Browse files
authored
Merge pull request #4691 from tautschnig/remove-flattening-exceptions
Remove now-unused bitvector conversion exceptions
2 parents e715a90 + 2b4f35e commit 4e29f7e

13 files changed

+19
-471
lines changed

src/goto-symex/equation_conversion_exceptions.h

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/goto-symex/symex_target_equation.cpp

Lines changed: 17 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ Author: Daniel Kroening, [email protected]
1414

1515
#include <util/format_expr.h>
1616
#include <util/std_expr.h>
17-
#include <util/throw_with_nested.h>
18-
#include <util/unwrap_nested_exception.h>
1917

2018
#include <solvers/decision_procedure.h>
21-
#include <solvers/flattening/bv_conversion_exceptions.h>
2219

23-
#include "equation_conversion_exceptions.h"
2420
#include "goto_symex_state.h"
2521
#include "ssa_step.h"
2622

@@ -329,24 +325,15 @@ void symex_target_equationt::constraint(
329325

330326
void symex_target_equationt::convert(decision_proceduret &decision_procedure)
331327
{
332-
try
333-
{
334-
convert_guards(decision_procedure);
335-
convert_assignments(decision_procedure);
336-
convert_decls(decision_procedure);
337-
convert_assumptions(decision_procedure);
338-
convert_assertions(decision_procedure);
339-
convert_goto_instructions(decision_procedure);
340-
convert_function_calls(decision_procedure);
341-
convert_io(decision_procedure);
342-
convert_constraints(decision_procedure);
343-
}
344-
catch(const equation_conversion_exceptiont &conversion_exception)
345-
{
346-
// unwrap the except and throw like normal
347-
const std::string full_error = unwrap_exception(conversion_exception);
348-
throw full_error;
349-
}
328+
convert_guards(decision_procedure);
329+
convert_assignments(decision_procedure);
330+
convert_decls(decision_procedure);
331+
convert_assumptions(decision_procedure);
332+
convert_assertions(decision_procedure);
333+
convert_goto_instructions(decision_procedure);
334+
convert_function_calls(decision_procedure);
335+
convert_io(decision_procedure);
336+
convert_constraints(decision_procedure);
350337
}
351338

352339
void symex_target_equationt::convert_assignments(
@@ -376,17 +363,8 @@ void symex_target_equationt::convert_decls(
376363
{
377364
// The result is not used, these have no impact on
378365
// the satisfiability of the formula.
379-
try
380-
{
381-
decision_procedure.handle(step.cond_expr);
382-
step.converted = true;
383-
}
384-
catch(const bitvector_conversion_exceptiont &)
385-
{
386-
util_throw_with_nested(
387-
equation_conversion_exceptiont(
388-
"Error converting decls for step", step));
389-
}
366+
decision_procedure.handle(step.cond_expr);
367+
step.converted = true;
390368
}
391369
}
392370
}
@@ -405,16 +383,7 @@ void symex_target_equationt::convert_guards(
405383
mstream << messaget::eom;
406384
});
407385

408-
try
409-
{
410-
step.guard_handle = decision_procedure.handle(step.guard);
411-
}
412-
catch(const bitvector_conversion_exceptiont &)
413-
{
414-
util_throw_with_nested(
415-
equation_conversion_exceptiont(
416-
"Error converting guard for step", step));
417-
}
386+
step.guard_handle = decision_procedure.handle(step.guard);
418387
}
419388
}
420389
}
@@ -436,16 +405,7 @@ void symex_target_equationt::convert_assumptions(
436405
mstream << messaget::eom;
437406
});
438407

439-
try
440-
{
441-
step.cond_handle = decision_procedure.handle(step.cond_expr);
442-
}
443-
catch(const bitvector_conversion_exceptiont &)
444-
{
445-
util_throw_with_nested(
446-
equation_conversion_exceptiont(
447-
"Error converting assumptions for step", step));
448-
}
408+
step.cond_handle = decision_procedure.handle(step.cond_expr);
449409
}
450410
}
451411
}
@@ -468,16 +428,7 @@ void symex_target_equationt::convert_goto_instructions(
468428
mstream << messaget::eom;
469429
});
470430

471-
try
472-
{
473-
step.cond_handle = decision_procedure.handle(step.cond_expr);
474-
}
475-
catch(const bitvector_conversion_exceptiont &)
476-
{
477-
util_throw_with_nested(
478-
equation_conversion_exceptiont(
479-
"Error converting goto instructions for step", step));
480-
}
431+
step.cond_handle = decision_procedure.handle(step.cond_expr);
481432
}
482433
}
483434
}
@@ -495,16 +446,8 @@ void symex_target_equationt::convert_constraints(
495446
mstream << messaget::eom;
496447
});
497448

498-
try
499-
{
500-
decision_procedure.set_to_true(step.cond_expr);
501-
step.converted = true;
502-
}
503-
catch(const bitvector_conversion_exceptiont &)
504-
{
505-
util_throw_with_nested(equation_conversion_exceptiont(
506-
"Error converting constraints for step", step));
507-
}
449+
decision_procedure.set_to_true(step.cond_expr);
450+
step.converted = true;
508451
}
509452
}
510453
}
@@ -569,16 +512,7 @@ void symex_target_equationt::convert_assertions(
569512
step.cond_expr);
570513

571514
// do the conversion
572-
try
573-
{
574-
step.cond_handle = decision_procedure.handle(implication);
575-
}
576-
catch(const bitvector_conversion_exceptiont &)
577-
{
578-
util_throw_with_nested(
579-
equation_conversion_exceptiont(
580-
"Error converting assertions for step", step));
581-
}
515+
step.cond_handle = decision_procedure.handle(implication);
582516

583517
// store disjunct
584518
disjuncts.push_back(not_exprt(step.cond_handle));

src/solvers/flattening/boolbv.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ bvt boolbvt::conversion_failed(const exprt &expr)
171171
/// \param expr: Expression to convert
172172
/// \return A vector of literals corresponding to the outputs of the Boolean
173173
/// circuit
174-
/// \throws bitvector_conversion_exceptiont raised if converting byte_extraction
175-
/// goes wrong.
176-
/// TODO: extend for other types of conversion exception (diffblue/cbmc#2103).
177174
bvt boolbvt::convert_bitvector(const exprt &expr)
178175
{
179176
if(expr.type().id()==ID_bool)

src/solvers/flattening/boolbv_byte_extract.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/expr_util.h>
1616
#include <util/pointer_offset_size.h>
1717
#include <util/std_expr.h>
18-
#include <util/throw_with_nested.h>
1918

2019
#include <solvers/lowering/expr_lowering.h>
21-
#include <solvers/lowering/flatten_byte_extract_exceptions.h>
2220

23-
#include "bv_conversion_exceptions.h"
2421
#include "bv_endianness_map.h"
2522

2623
bvt map_bv(const bv_endianness_mapt &map, const bvt &src)
@@ -45,15 +42,7 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
4542
// unbounded arrays
4643
if(is_unbounded_array(expr.op().type()))
4744
{
48-
try
49-
{
50-
return convert_bv(lower_byte_extract(expr, ns));
51-
}
52-
catch(const flatten_byte_extract_exceptiont &)
53-
{
54-
util_throw_with_nested(
55-
bitvector_conversion_exceptiont("Can't convert byte_extraction", expr));
56-
}
45+
return convert_bv(lower_byte_extract(expr, ns));
5746
}
5847

5948
const std::size_t width = boolbv_width(expr.type());

src/solvers/flattening/boolbv_byte_update.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ Author: Daniel Kroening, [email protected]
1212
#include <util/byte_operators.h>
1313
#include <util/expr_util.h>
1414
#include <util/invariant.h>
15-
#include <util/throw_with_nested.h>
1615

1716
#include <solvers/lowering/expr_lowering.h>
18-
#include <solvers/lowering/flatten_byte_extract_exceptions.h>
1917

20-
#include "bv_conversion_exceptions.h"
2118
#include "bv_endianness_map.h"
2219

2320
bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
@@ -28,15 +25,7 @@ bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
2825
is_unbounded_array(expr.op().type()) ||
2926
is_unbounded_array(expr.value().type()))
3027
{
31-
try
32-
{
33-
return convert_bv(lower_byte_update(expr, ns));
34-
}
35-
catch(const flatten_byte_extract_exceptiont &byte_extract_flatten_exception)
36-
{
37-
util_throw_with_nested(
38-
bitvector_conversion_exceptiont("Can't convert byte_update", expr));
39-
}
28+
return convert_bv(lower_byte_update(expr, ns));
4029
}
4130

4231
const exprt &op = expr.op();

src/solvers/flattening/boolbv_equality.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <solvers/lowering/expr_lowering.h>
1515

16-
#include "bv_conversion_exceptions.h"
17-
1816
literalt boolbvt::convert_equality(const equal_exprt &expr)
1917
{
2018
const bool equality_types_match = expr.lhs().type() == expr.rhs().type();

src/solvers/flattening/bv_conversion_exceptions.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/solvers/lowering/byte_operators.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Author: Daniel Kroening, [email protected]
2121
#include <util/simplify_expr.h>
2222
#include <util/string_constant.h>
2323

24-
#include "flatten_byte_extract_exceptions.h"
25-
2624
static exprt bv_to_expr(
2725
const exprt &bitvector_expr,
2826
const typet &target_type,

0 commit comments

Comments
 (0)