Skip to content

Commit 9fa0733

Browse files
author
Daniel Kroening
committed
use proper constructor for codet
1 parent dbbd568 commit 9fa0733

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/goto-programs/builtin_functions.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ void goto_convertt::do_input(
324324
const exprt::operandst &arguments,
325325
goto_programt &dest)
326326
{
327-
codet input_code;
328-
input_code.set_statement(ID_input);
327+
codet input_code(ID_input);
329328
input_code.operands()=arguments;
330329
input_code.add_source_location()=function.source_location();
331330

@@ -344,8 +343,7 @@ void goto_convertt::do_output(
344343
const exprt::operandst &arguments,
345344
goto_programt &dest)
346345
{
347-
codet output_code;
348-
output_code.set_statement(ID_output);
346+
codet output_code(ID_output);
349347
output_code.operands()=arguments;
350348
output_code.add_source_location()=function.source_location();
351349

@@ -605,8 +603,7 @@ void goto_convertt::do_array_op(
605603
throw 0;
606604
}
607605

608-
codet array_op_statement;
609-
array_op_statement.set_statement(id);
606+
codet array_op_statement(id);
610607
array_op_statement.operands()=arguments;
611608
array_op_statement.add_source_location()=function.source_location();
612609

src/goto-programs/goto_convert_side_effect.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,6 @@ void goto_convertt::remove_cpp_new(
425425
goto_programt &dest,
426426
bool result_is_used)
427427
{
428-
codet call;
429-
430428
const symbolt &new_symbol = get_fresh_aux_symbol(
431429
expr.type(),
432430
tmp_symbol_prefix,
@@ -440,7 +438,7 @@ void goto_convertt::remove_cpp_new(
440438
decl.add_source_location()=new_symbol.location;
441439
convert_decl(decl, dest, ID_cpp);
442440

443-
call=code_assignt(new_symbol.symbol_expr(), expr);
441+
const code_assignt call(new_symbol.symbol_expr(), expr);
444442

445443
if(result_is_used)
446444
static_cast<exprt &>(expr)=new_symbol.symbol_expr();
@@ -456,9 +454,7 @@ void goto_convertt::remove_cpp_delete(
456454
{
457455
assert(expr.operands().size()==1);
458456

459-
codet tmp;
460-
461-
tmp.set_statement(expr.get_statement());
457+
codet tmp(expr.get_statement());
462458
tmp.add_source_location()=expr.source_location();
463459
tmp.copy_to_operands(expr.op0());
464460
tmp.set(ID_destructor, expr.find(ID_destructor));

src/util/std_code.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ code_blockt &codet::make_block()
2929
exprt tmp;
3030
tmp.swap(*this);
3131

32-
*this=codet();
33-
set_statement(ID_block);
32+
*this = codet(ID_block);
3433
move_to_operands(tmp);
3534

3635
return static_cast<code_blockt &>(*this);

0 commit comments

Comments
 (0)