Skip to content

Commit c274c15

Browse files
Set mode in goto_convert auxiliary symbols
1 parent 9a896f9 commit c274c15

File tree

5 files changed

+36
-34
lines changed

5 files changed

+36
-34
lines changed

src/goto-programs/builtin_functions.cpp

+13-14
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ void goto_convertt::do_cpp_new(
468468
assert(code_type.parameters().size()==1 ||
469469
code_type.parameters().size()==2);
470470

471-
const symbolt &tmp_symbol=
472-
new_tmp_symbol(return_type, "new", dest, rhs.source_location());
471+
const symbolt &tmp_symbol =
472+
new_tmp_symbol(return_type, "new", dest, rhs.source_location(), ID_cpp);
473473

474474
tmp_symbol_expr=tmp_symbol.symbol_expr();
475475

@@ -499,8 +499,8 @@ void goto_convertt::do_cpp_new(
499499
assert(code_type.parameters().size()==2 ||
500500
code_type.parameters().size()==3);
501501

502-
const symbolt &tmp_symbol=
503-
new_tmp_symbol(return_type, "new", dest, rhs.source_location());
502+
const symbolt &tmp_symbol =
503+
new_tmp_symbol(return_type, "new", dest, rhs.source_location(), ID_cpp);
504504

505505
tmp_symbol_expr=tmp_symbol.symbol_expr();
506506

@@ -663,13 +663,10 @@ void goto_convertt::do_java_new_array(
663663
// Must directly assign the new array to a temporary
664664
// because goto-symex will notice `x=side_effect_exprt` but not
665665
// `x=typecast_exprt(side_effect_exprt(...))`
666-
symbol_exprt new_array_data_symbol=
666+
symbol_exprt new_array_data_symbol =
667667
new_tmp_symbol(
668-
data_java_new_expr.type(),
669-
"new_array_data",
670-
dest,
671-
location)
672-
.symbol_expr();
668+
data_java_new_expr.type(), "new_array_data", dest, location, ID_java)
669+
.symbol_expr();
673670
goto_programt::targett t_p2=dest.add_instruction(ASSIGN);
674671
t_p2->code=code_assignt(new_array_data_symbol, data_java_new_expr);
675672
t_p2->source_location=location;
@@ -707,8 +704,9 @@ void goto_convertt::do_java_new_array(
707704

708705
goto_programt tmp;
709706

710-
symbol_exprt tmp_i=
711-
new_tmp_symbol(length.type(), "index", tmp, location).symbol_expr();
707+
symbol_exprt tmp_i =
708+
new_tmp_symbol(length.type(), "index", tmp, location, ID_java)
709+
.symbol_expr();
712710

713711
code_fort for_loop;
714712

@@ -730,8 +728,9 @@ void goto_convertt::do_java_new_array(
730728
plus_exprt(data, tmp_i), data.type().subtype());
731729

732730
code_blockt for_body;
733-
symbol_exprt init_sym=
734-
new_tmp_symbol(sub_type, "subarray_init", tmp, location).symbol_expr();
731+
symbol_exprt init_sym =
732+
new_tmp_symbol(sub_type, "subarray_init", tmp, location, ID_java)
733+
.symbol_expr();
735734

736735
code_assignt init_subarray(init_sym, sub_java_new);
737736
code_assignt assign_subarray(

src/goto-programs/goto_clean_expr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ void goto_convertt::clean_expr(
237237

238238
if(result_is_used)
239239
{
240-
symbolt &new_symbol=
241-
new_tmp_symbol(expr.type(), "if_expr", dest, source_location);
240+
symbolt &new_symbol = new_tmp_symbol(
241+
expr.type(), "if_expr", dest, source_location, expr.get(ID_mode));
242242

243243
code_assignt assignment_true;
244244
assignment_true.lhs()=new_symbol.symbol_expr();

src/goto-programs/goto_convert.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -2055,16 +2055,16 @@ symbolt &goto_convertt::new_tmp_symbol(
20552055
const typet &type,
20562056
const std::string &suffix,
20572057
goto_programt &dest,
2058-
const source_locationt &source_location)
2058+
const source_locationt &source_location,
2059+
const irep_idt &mode)
20592060
{
2060-
symbolt &new_symbol=
2061-
get_fresh_aux_symbol(
2062-
type,
2063-
tmp_symbol_prefix,
2064-
"tmp_"+suffix,
2065-
source_location,
2066-
irep_idt(),
2067-
symbol_table);
2061+
symbolt &new_symbol = get_fresh_aux_symbol(
2062+
type,
2063+
tmp_symbol_prefix,
2064+
"tmp_" + suffix,
2065+
source_location,
2066+
mode,
2067+
symbol_table);
20682068

20692069
code_declt decl;
20702070
decl.symbol()=new_symbol.symbol_expr();
@@ -2081,8 +2081,8 @@ void goto_convertt::make_temp_symbol(
20812081
{
20822082
const source_locationt source_location=expr.find_source_location();
20832083

2084-
symbolt &new_symbol=
2085-
new_tmp_symbol(expr.type(), suffix, dest, source_location);
2084+
symbolt &new_symbol = new_tmp_symbol(
2085+
expr.type(), suffix, dest, source_location, expr.get(ID_mode));
20862086

20872087
code_assignt assignment;
20882088
assignment.lhs()=new_symbol.symbol_expr();

src/goto-programs/goto_convert_class.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class goto_convertt:public messaget
5959
const typet &type,
6060
const std::string &suffix,
6161
goto_programt &dest,
62-
const source_locationt &);
62+
const source_locationt &,
63+
const irep_idt &mode);
6364

6465
symbol_exprt make_compound_literal(
6566
const exprt &expr,

src/goto-programs/goto_convert_side_effect.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,8 @@ void goto_convertt::remove_temporary_object(
522522
throw 0;
523523
}
524524

525-
symbolt &new_symbol=
526-
new_tmp_symbol(expr.type(), "obj", dest, expr.find_source_location());
527-
528-
new_symbol.mode=expr.get(ID_mode);
525+
symbolt &new_symbol = new_tmp_symbol(
526+
expr.type(), "obj", dest, expr.find_source_location(), expr.get(ID_mode));
529527

530528
if(expr.operands().size()==1)
531529
{
@@ -599,8 +597,12 @@ void goto_convertt::remove_statement_expression(
599597

600598
source_locationt source_location=last.find_source_location();
601599

602-
symbolt &new_symbol=
603-
new_tmp_symbol(expr.type(), "statement_expression", dest, source_location);
600+
symbolt &new_symbol = new_tmp_symbol(
601+
expr.type(),
602+
"statement_expression",
603+
dest,
604+
source_location,
605+
expr.get(ID_mode));
604606

605607
symbol_exprt tmp_symbol_expr(new_symbol.name, new_symbol.type);
606608
tmp_symbol_expr.add_source_location()=source_location;

0 commit comments

Comments
 (0)