Skip to content

Commit bf02ec7

Browse files
author
Daniel Kroening
committed
use proper constructor for code_declt
1 parent 9fa0733 commit bf02ec7

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

src/ansi-c/c_typecheck_code.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,8 @@ void c_typecheck_baset::typecheck_decl(codet &code)
322322
}
323323
else
324324
{
325-
code_declt code;
325+
code_declt code(symbol.symbol_expr());
326326
code.add_source_location()=symbol.location;
327-
code.symbol()=symbol.symbol_expr();
328327
code.symbol().add_source_location()=symbol.location;
329328

330329
// add initializer, if any

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,8 @@ void c_typecheck_baset::typecheck_expr_operands(exprt &expr)
724724
throw 0;
725725
}
726726

727-
code_declt decl;
727+
code_declt decl(symbol.symbol_expr());
728728
decl.add_source_location()=declaration.source_location();
729-
decl.symbol()=symbol.symbol_expr();
730729

731730
expr.op0()=decl;
732731

src/goto-programs/goto_convert.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,8 +1990,7 @@ symbolt &goto_convertt::new_tmp_symbol(
19901990
mode,
19911991
symbol_table);
19921992

1993-
code_declt decl;
1994-
decl.symbol()=new_symbol.symbol_expr();
1993+
code_declt decl(new_symbol.symbol_expr());
19951994
decl.add_source_location()=source_location;
19961995
convert_decl(decl, dest, mode);
19971996

src/goto-programs/goto_convert_side_effect.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ void goto_convertt::remove_function_call(
390390
symbol_table);
391391

392392
{
393-
code_declt decl;
394-
decl.symbol()=new_symbol.symbol_expr();
393+
code_declt decl(new_symbol.symbol_expr());
395394
decl.add_source_location()=new_symbol.location;
396395
convert_decl(decl, dest, mode);
397396
}
@@ -433,8 +432,7 @@ void goto_convertt::remove_cpp_new(
433432
ID_cpp,
434433
symbol_table);
435434

436-
code_declt decl;
437-
decl.symbol()=new_symbol.symbol_expr();
435+
code_declt decl(new_symbol.symbol_expr());
438436
decl.add_source_location()=new_symbol.location;
439437
convert_decl(decl, dest, ID_cpp);
440438

0 commit comments

Comments
 (0)