Skip to content

Commit 0ebb484

Browse files
committed
fixup! Consistently resize instead of just reserving in codet classes
1 parent 06942bb commit 0ebb484

6 files changed

+10
-15
lines changed

src/analyses/flow_insensitive_analysis.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,14 @@ bool flow_insensitive_analysis_baset::do_function_call(
341341

342342
goto_programt temp;
343343

344+
exprt rhs=side_effect_expr_nondett(code.lhs().type());
345+
344346
goto_programt::targett r=temp.add_instruction();
345347
r->make_return();
346-
r->code=code_returnt();
348+
r->code=code_returnt(rhs);
347349
r->function=f_it->first;
348350
r->location_number=0;
349351

350-
exprt rhs=side_effect_expr_nondett(code.lhs().type());
351-
r->code.move_to_operands(rhs);
352-
353352
goto_programt::targett t=temp.add_instruction(END_FUNCTION);
354353
t->code.set(ID_identifier, code.function());
355354
t->function=f_it->first;

src/cpp/cpp_typecheck_compound_type.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,7 @@ void cpp_typecheckt::typecheck_compound_declarator(
692692
namespacet(symbol_table).lookup(args[i].get(ID_C_identifier)).symbol_expr());
693693
}
694694

695-
code_returnt code_return;
696-
code_return.return_value() = expr_call;
697-
698-
func_symb.value = code_return;
695+
func_symb.value=code_returnt(expr_call);
699696
}
700697
else
701698
{

src/goto-instrument/goto_program2code.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ goto_programt::const_targett goto_program2codet::convert_return(
556556
goto_programt::const_targett upper_bound,
557557
codet &dest)
558558
{
559-
code_returnt ret=to_code_return(target->code);
559+
const code_returnt &ret=to_code_return(target->code);
560560

561561
// add return instruction unless original code was missing a return
562562
if(!ret.has_return_value() ||

src/goto-programs/goto_convert.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ void goto_convertt::convert_return(
16221622

16231623
// remove void-typed return value
16241624
if(!result_is_used)
1625-
new_code.operands().resize(0);
1625+
new_code.return_value().make_nil();
16261626
}
16271627

16281628
if(targets.has_return_value)

src/goto-programs/goto_convert_functions.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,12 @@ void goto_convert_functionst::add_return(
186186

187187
#endif
188188

189+
side_effect_expr_nondett rhs(f.type.return_type());
190+
189191
goto_programt::targett t=f.body.add_instruction();
190192
t->make_return();
191-
t->code=code_returnt();
193+
t->code=code_returnt(rhs);
192194
t->source_location=source_location;
193-
194-
side_effect_expr_nondett rhs(f.type.return_type());
195-
t->code.move_to_operands(rhs);
196195
}
197196

198197
/*******************************************************************\

src/goto-programs/goto_convert_new_switch_case.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ void goto_convertt::convert_return(
15081508

15091509
// remove void-typed return value
15101510
if(!result_is_used)
1511-
new_code.operands().resize(0);
1511+
new_code.return_value().make_nil();
15121512
}
15131513

15141514
if(targets.has_return_value)

0 commit comments

Comments
 (0)