Skip to content

Commit 34e7cf0

Browse files
Set mode in goto_convert auxiliary symbols
1 parent befc225 commit 34e7cf0

File tree

5 files changed

+36
-34
lines changed

5 files changed

+36
-34
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 13 additions & 14 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,16 +2029,16 @@ symbolt &goto_convertt::new_tmp_symbol(
20292029
const typet &type,
20302030
const std::string &suffix,
20312031
goto_programt &dest,
2032-
const source_locationt &source_location)
2032+
const source_locationt &source_location,
2033+
const irep_idt &mode)
20332034
{
2034-
symbolt &new_symbol=
2035-
get_fresh_aux_symbol(
2036-
type,
2037-
tmp_symbol_prefix,
2038-
"tmp_"+suffix,
2039-
source_location,
2040-
irep_idt(),
2041-
symbol_table);
2035+
symbolt &new_symbol = get_fresh_aux_symbol(
2036+
type,
2037+
tmp_symbol_prefix,
2038+
"tmp_" + suffix,
2039+
source_location,
2040+
mode,
2041+
symbol_table);
20422042

20432043
code_declt decl;
20442044
decl.symbol()=new_symbol.symbol_expr();
@@ -2055,8 +2055,8 @@ void goto_convertt::make_temp_symbol(
20552055
{
20562056
const source_locationt source_location=expr.find_source_location();
20572057

2058-
symbolt &new_symbol=
2059-
new_tmp_symbol(expr.type(), suffix, dest, source_location);
2058+
symbolt &new_symbol = new_tmp_symbol(
2059+
expr.type(), suffix, dest, source_location, expr.get(ID_mode));
20602060

20612061
code_assignt assignment;
20622062
assignment.lhs()=new_symbol.symbol_expr();

src/goto-programs/goto_convert_class.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class goto_convertt:public messaget
6161
const typet &type,
6262
const std::string &suffix,
6363
goto_programt &dest,
64-
const source_locationt &);
64+
const source_locationt &,
65+
const irep_idt &mode);
6566

6667
symbol_exprt make_compound_literal(
6768
const exprt &expr,

src/goto-programs/goto_convert_side_effect.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,8 @@ void goto_convertt::remove_temporary_object(
519519
throw 0;
520520
}
521521

522-
symbolt &new_symbol=
523-
new_tmp_symbol(expr.type(), "obj", dest, expr.find_source_location());
524-
525-
new_symbol.mode=expr.get(ID_mode);
522+
symbolt &new_symbol = new_tmp_symbol(
523+
expr.type(), "obj", dest, expr.find_source_location(), expr.get(ID_mode));
526524

527525
if(expr.operands().size()==1)
528526
{
@@ -596,8 +594,12 @@ void goto_convertt::remove_statement_expression(
596594

597595
source_locationt source_location=last.find_source_location();
598596

599-
symbolt &new_symbol=
600-
new_tmp_symbol(expr.type(), "statement_expression", dest, source_location);
597+
symbolt &new_symbol = new_tmp_symbol(
598+
expr.type(),
599+
"statement_expression",
600+
dest,
601+
source_location,
602+
expr.get(ID_mode));
601603

602604
symbol_exprt tmp_symbol_expr(new_symbol.name, new_symbol.type);
603605
tmp_symbol_expr.add_source_location()=source_location;

0 commit comments

Comments
 (0)