19
19
20
20
#include " path_symex.h"
21
21
22
- // #define DEBUG
22
+ // #define DEBUG
23
23
24
24
#ifdef DEBUG
25
25
#include < iostream>
@@ -304,7 +304,8 @@ void path_symext::symex_malloc(
304
304
mp_integer elements=alloc_size/elem_size;
305
305
306
306
if (elements*elem_size==alloc_size)
307
- object_type=array_typet (tmp_type, from_integer (elements, tmp_size.type ()));
307
+ object_type=
308
+ array_typet (tmp_type, from_integer (elements, tmp_size.type ()));
308
309
}
309
310
}
310
311
}
@@ -329,8 +330,6 @@ void path_symext::symex_malloc(
329
330
size_symbol.type =tmp_size.type ();
330
331
size_symbol.mode =ID_C;
331
332
332
- // state.var_map(size_symbol.name, suffix, size_symbol.type);
333
-
334
333
assign (state,
335
334
size_symbol.symbol_expr (),
336
335
size);
@@ -342,15 +341,14 @@ void path_symext::symex_malloc(
342
341
// value
343
342
symbolt value_symbol;
344
343
345
- value_symbol.base_name =" dynamic_object" +std::to_string (state.var_map .dynamic_count );
344
+ value_symbol.base_name =
345
+ " dynamic_object" +std::to_string (state.var_map .dynamic_count );
346
346
value_symbol.name =" symex_dynamic::" +id2string (value_symbol.base_name );
347
347
value_symbol.is_lvalue =true ;
348
348
value_symbol.type =object_type;
349
349
value_symbol.type .set (" #dynamic" , true );
350
350
value_symbol.mode =ID_C;
351
351
352
- // state.var_map(value_symbol.name, suffix, value_symbol.type);
353
-
354
352
address_of_exprt rhs;
355
353
356
354
if (object_type.id ()==ID_array)
@@ -391,11 +389,11 @@ void path_symext::assign_rec(
391
389
const exprt &ssa_lhs,
392
390
const exprt &ssa_rhs)
393
391
{
394
- // const typet &ssa_lhs_type=state.var_map.ns.follow(ssa_lhs.type());
392
+ // const typet &ssa_lhs_type=state.var_map.ns.follow(ssa_lhs.type());
395
393
396
394
#ifdef DEBUG
397
395
std::cout << " assign_rec: " << ssa_lhs.pretty () << std::endl;
398
- // std::cout << "ssa_lhs_type: " << ssa_lhs_type.id() << std::endl;
396
+ // std::cout << "ssa_lhs_type: " << ssa_lhs_type.id() << std::endl;
399
397
#endif
400
398
401
399
if (ssa_lhs.id ()==ID_symbol)
@@ -586,7 +584,8 @@ void path_symext::assign_rec(
586
584
{
587
585
exprt new_rhs=
588
586
ssa_rhs.is_nil ()?ssa_rhs:
589
- simplify_expr (member_exprt (ssa_rhs, components[i].get_name (), components[i].type ()),
587
+ simplify_expr (
588
+ member_exprt (ssa_rhs, components[i].get_name (), components[i].type ()),
590
589
state.var_map .ns );
591
590
assign_rec (state, guard, operands[i], new_rhs);
592
591
}
@@ -608,7 +607,11 @@ void path_symext::assign_rec(
608
607
{
609
608
exprt new_rhs=
610
609
ssa_rhs.is_nil ()?ssa_rhs:
611
- simplify_expr (index_exprt (ssa_rhs, from_integer (i, index_type ()), array_type.subtype ()),
610
+ simplify_expr (
611
+ index_exprt (
612
+ ssa_rhs,
613
+ from_integer (i, index_type ()),
614
+ array_type.subtype ()),
612
615
state.var_map .ns );
613
616
assign_rec (state, guard, operands[i], new_rhs);
614
617
}
@@ -625,7 +628,11 @@ void path_symext::assign_rec(
625
628
{
626
629
exprt new_rhs=
627
630
ssa_rhs.is_nil ()?ssa_rhs:
628
- simplify_expr (index_exprt (ssa_rhs, from_integer (i, index_type ()), vector_type.subtype ()),
631
+ simplify_expr (
632
+ index_exprt (
633
+ ssa_rhs,
634
+ from_integer (i, index_type ()),
635
+ vector_type.subtype ()),
629
636
state.var_map .ns );
630
637
assign_rec (state, guard, operands[i], new_rhs);
631
638
}
@@ -677,7 +684,9 @@ void path_symext::function_call_rec(
677
684
state.locs .function_map .find (function_identifier);
678
685
679
686
if (f_it==state.locs .function_map .end ())
680
- throw " failed to find `" +id2string (function_identifier)+" ' in function_map" ;
687
+ throw
688
+ " failed to find `" +id2string (function_identifier)+
689
+ " ' in function_map" ;
681
690
682
691
const locst::function_entryt &function_entry=f_it->second ;
683
692
@@ -697,7 +706,8 @@ void path_symext::function_call_rec(
697
706
}
698
707
699
708
// push a frame on the call stack
700
- path_symex_statet::threadt &thread=state.threads [state.get_current_thread ()];
709
+ path_symex_statet::threadt &thread=
710
+ state.threads [state.get_current_thread ()];
701
711
thread.call_stack .push_back (path_symex_statet::framet ());
702
712
thread.call_stack .back ().current_function =function_identifier;
703
713
thread.call_stack .back ().return_location =thread.pc .next_loc ();
@@ -748,7 +758,7 @@ void path_symext::function_call_rec(
748
758
const if_exprt &if_expr=to_if_expr (function);
749
759
exprt guard=if_expr.cond ();
750
760
751
- if (state.is_lazy ())
761
+ if (state.is_lazy ())
752
762
{
753
763
const exprt &case_expr=state.restore_branch ()?
754
764
if_expr.true_case ():if_expr.false_case ();
@@ -762,7 +772,8 @@ void path_symext::function_call_rec(
762
772
path_symex_statet &false_state=further_states.back ();
763
773
false_state.record_branch_step (false );
764
774
false_state.history ->guard =not_exprt (guard);
765
- function_call_rec (further_states.back (), call, if_expr.false_case (), further_states);
775
+ function_call_rec (
776
+ further_states.back (), call, if_expr.false_case (), further_states);
766
777
}
767
778
768
779
// do the true-case in 'state'
@@ -893,11 +904,10 @@ void path_symext::do_goto(
893
904
#endif
894
905
895
906
#ifdef PATH_SYMEX_FORK
896
- if (pid==- 1 )
897
- // forking failed so continue as if PATH_SYMEX_FORK were undefined
907
+ // forking failed so continue as if PATH_SYMEX_FORK were undefined
908
+ if (pid==- 1 ) // NOLINT(readability/braces)
898
909
#endif
899
910
{
900
-
901
911
#ifdef PATH_SYMEX_LAZY_STATE
902
912
// lazily copy the state into 'further_states'
903
913
further_states.push_back (path_symex_statet::lazy_copy (state));
@@ -913,9 +923,9 @@ void path_symext::do_goto(
913
923
}
914
924
915
925
#ifdef PATH_SYMEX_FORK
916
- if (pid!= 0 )
917
- // parent process (regardless of any possible fork errors)
918
- // should finish to explore all current 'further_states'
926
+ // parent process (regardless of any possible fork errors )
927
+ // should finish to explore all current 'further_states'
928
+ if (pid!= 0 ) // NOLINT(readability/braces)
919
929
#endif
920
930
{
921
931
// branch not taken case
@@ -1024,7 +1034,8 @@ void path_symext::operator()(
1024
1034
1025
1035
// ordering of the following matters due to vector instability
1026
1036
path_symex_statet::threadt &new_thread=state.add_thread ();
1027
- path_symex_statet::threadt &old_thread=state.threads [state.get_current_thread ()];
1037
+ path_symex_statet::threadt &old_thread=
1038
+ state.threads [state.get_current_thread ()];
1028
1039
new_thread.pc =loc.branch_target ;
1029
1040
new_thread.local_vars =old_thread.local_vars ;
1030
1041
}
@@ -1036,7 +1047,7 @@ void path_symext::operator()(
1036
1047
break ;
1037
1048
1038
1049
case GOTO:
1039
- if (state.is_lazy ())
1050
+ if (state.is_lazy ())
1040
1051
do_goto (state, state.restore_branch ());
1041
1052
else
1042
1053
do_goto (state, further_states);
@@ -1103,7 +1114,8 @@ void path_symext::operator()(
1103
1114
1104
1115
case FUNCTION_CALL:
1105
1116
state.record_step ();
1106
- function_call (state, to_code_function_call (instruction.code ), further_states);
1117
+ function_call (
1118
+ state, to_code_function_call (instruction.code ), further_states);
1107
1119
break ;
1108
1120
1109
1121
case OTHER:
0 commit comments