Skip to content

Commit 39dceb8

Browse files
committed
Construct side_effect_expr_function_callt in a non-deprecated way
The constructor requires four arguments.
1 parent 4eb7d04 commit 39dceb8

File tree

8 files changed

+69
-86
lines changed

8 files changed

+69
-86
lines changed

src/cpp/cpp_constructor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ optionalt<codet> cpp_typecheckt::cpp_constructor(
225225

226226
side_effect_expr_function_callt function_call(
227227
cpp_namet(constructor_name, source_location).as_expr(),
228-
operands_tc);
229-
230-
function_call.add_source_location()=source_location;
228+
operands_tc,
229+
typet(),
230+
source_location);
231231

232232
typecheck_side_effect_function_call(function_call);
233233
assert(function_call.get(ID_statement)==ID_temporary_object);

src/cpp/cpp_destructor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ optionalt<codet> cpp_typecheckt::cpp_destructor(
108108
member.add(ID_component_cpp_name) = cpp_name;
109109
member.copy_to_operands(object);
110110

111-
side_effect_expr_function_callt function_call;
112-
function_call.add_source_location()=source_location;
113-
function_call.function().swap(member);
111+
side_effect_expr_function_callt function_call(
112+
std::move(member), {}, typet{}, source_location);
114113

115114
typecheck_side_effect_function_call(function_call);
116115
already_typechecked(function_call);

src/cpp/cpp_typecheck_code.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ void cpp_typecheckt::typecheck_member_initializer(codet &code)
203203
assert(code_type.parameters().size()>=1);
204204

205205
// It's a parent. Call the constructor that we got.
206-
side_effect_expr_function_callt function_call;
207-
208-
function_call.function()=symbol_expr;
209-
function_call.add_source_location()=code.source_location();
206+
side_effect_expr_function_callt function_call(
207+
symbol_expr, {}, typet{}, code.source_location());
210208
function_call.arguments().reserve(code.operands().size()+1);
211209

212210
// we have to add 'this'

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,12 @@ void cpp_typecheckt::typecheck_compound_declarator(
651651
lookup(args[0].get(ID_C_identifier)).symbol_expr(),
652652
to_code_type(component.type()).parameters()[0].type());
653653

654-
side_effect_expr_function_callt expr_call;
655-
expr_call.function() =
656-
symbol_exprt(component.get_name(), component.type());
654+
side_effect_expr_function_callt expr_call(
655+
symbol_exprt(component.get_name(), component.type()),
656+
{late_cast},
657+
typet{},
658+
source_locationt{});
657659
expr_call.arguments().reserve(args.size());
658-
expr_call.arguments().push_back(late_cast);
659660

660661
for(const auto &arg : args)
661662
{

src/cpp/cpp_typecheck_conversions.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,11 @@ bool cpp_typecheckt::user_defined_conversion_sequence(
991991
}
992992

993993
// create temporary object
994-
side_effect_expr_function_callt ctor_expr;
995-
ctor_expr.add_source_location()=expr.source_location();
996-
ctor_expr.function().swap(func_symb);
997-
ctor_expr.arguments().push_back(tmp_expr);
994+
side_effect_expr_function_callt ctor_expr(
995+
std::move(func_symb),
996+
{tmp_expr},
997+
typet{},
998+
expr.source_location());
998999
typecheck_side_effect_function_call(ctor_expr);
9991000

10001001
new_expr.swap(ctor_expr);
@@ -1041,10 +1042,11 @@ bool cpp_typecheckt::user_defined_conversion_sequence(
10411042
func_symb.swap(func_symb);
10421043
}
10431044

1044-
side_effect_expr_function_callt ctor_expr;
1045-
ctor_expr.add_source_location()=expr.source_location();
1046-
ctor_expr.function().swap(func_symb);
1047-
ctor_expr.arguments().push_back(expr_deref);
1045+
side_effect_expr_function_callt ctor_expr(
1046+
std::move(func_symb),
1047+
{expr_deref},
1048+
typet{},
1049+
expr.source_location());
10481050
typecheck_side_effect_function_call(ctor_expr);
10491051

10501052
new_expr.swap(ctor_expr);
@@ -1101,9 +1103,8 @@ bool cpp_typecheckt::user_defined_conversion_sequence(
11011103
ac.copy_to_operands(expr);
11021104
member_func.copy_to_operands(ac);
11031105

1104-
side_effect_expr_function_callt func_expr;
1105-
func_expr.add_source_location()=expr.source_location();
1106-
func_expr.function().swap(member_func);
1106+
side_effect_expr_function_callt func_expr(
1107+
std::move(member_func), {}, typet{}, expr.source_location());
11071108
typecheck_side_effect_function_call(func_expr);
11081109

11091110
if(standard_conversion_sequence(func_expr, type, tmp_expr, tmp_rank))
@@ -1328,9 +1329,8 @@ bool cpp_typecheckt::reference_binding(
13281329
ac.copy_to_operands(expr);
13291330
member_func.copy_to_operands(ac);
13301331

1331-
side_effect_expr_function_callt func_expr;
1332-
func_expr.add_source_location()=expr.source_location();
1333-
func_expr.function().swap(member_func);
1332+
side_effect_expr_function_callt func_expr(
1333+
std::move(member_func), {}, typet{}, expr.source_location());
13341334
typecheck_side_effect_function_call(func_expr);
13351335

13361336
// let's check if the returned value binds directly

src/cpp/cpp_typecheck_expr.cpp

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,13 @@ void cpp_typecheckt::typecheck_function_expr(
381381
std::string op_name="operator->";
382382

383383
// turn this into a function call
384-
side_effect_expr_function_callt function_call;
385-
function_call.arguments().reserve(expr.operands().size());
386-
function_call.add_source_location()=expr.source_location();
387-
388384
// first do function/operator
389385
const cpp_namet cpp_name(op_name, expr.source_location());
390386

391-
function_call.function() = cpp_name.as_expr();
387+
side_effect_expr_function_callt function_call(
388+
cpp_name.as_expr(), {expr.op0()}, typet{}, expr.source_location());
389+
function_call.arguments().reserve(expr.operands().size());
392390

393-
// now do the argument
394-
function_call.arguments().push_back(expr.op0());
395391
typecheck_side_effect_function_call(function_call);
396392

397393
exprt tmp(ID_already_typechecked);
@@ -487,10 +483,6 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
487483
std::string op_name=std::string("operator")+"("+cpp_type2name(t)+")";
488484

489485
// turn this into a function call
490-
side_effect_expr_function_callt function_call;
491-
function_call.arguments().reserve(expr.operands().size());
492-
function_call.add_source_location()=expr.source_location();
493-
494486
const cpp_namet cpp_name(op_name, expr.source_location());
495487

496488
// See if the struct declares the cast operator as a member
@@ -513,16 +505,16 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
513505
if(!found_in_struct)
514506
return false;
515507

516-
{
517-
exprt member(ID_member);
518-
member.add(ID_component_cpp_name)= cpp_name;
508+
exprt member(ID_member);
509+
member.add(ID_component_cpp_name) = cpp_name;
519510

520-
exprt tmp(ID_already_typechecked);
521-
tmp.copy_to_operands(expr.op0());
522-
member.copy_to_operands(tmp);
511+
exprt tmp(ID_already_typechecked);
512+
tmp.copy_to_operands(expr.op0());
513+
member.copy_to_operands(tmp);
523514

524-
function_call.function()=member;
525-
}
515+
side_effect_expr_function_callt function_call(
516+
std::move(member), {}, typet{}, expr.source_location());
517+
function_call.arguments().reserve(expr.operands().size());
526518

527519
if(expr.operands().size()>1)
528520
{
@@ -563,10 +555,6 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
563555
const cpp_namet cpp_name(op_name, expr.source_location());
564556

565557
// turn this into a function call
566-
side_effect_expr_function_callt function_call;
567-
function_call.arguments().reserve(expr.operands().size());
568-
function_call.add_source_location()=expr.source_location();
569-
570558
// There are two options to overload an operator:
571559
//
572560
// 1. In the scope of a as a.operator(b, ...)
@@ -603,16 +591,16 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
603591
if(resolve_result.is_not_nil())
604592
{
605593
// Found! We turn op(a, b, ...) into a.op(b, ...)
606-
{
607-
exprt member(ID_member);
608-
member.add(ID_component_cpp_name)=cpp_name;
594+
exprt member(ID_member);
595+
member.add(ID_component_cpp_name) = cpp_name;
609596

610-
exprt tmp(ID_already_typechecked);
611-
tmp.copy_to_operands(expr.op0());
612-
member.copy_to_operands(tmp);
597+
exprt tmp(ID_already_typechecked);
598+
tmp.copy_to_operands(expr.op0());
599+
member.copy_to_operands(tmp);
613600

614-
function_call.function()=member;
615-
}
601+
side_effect_expr_function_callt function_call(
602+
std::move(member), {}, typet{}, expr.source_location());
603+
function_call.arguments().reserve(expr.operands().size());
616604

617605
if(expr.operands().size()>1)
618606
{
@@ -645,9 +633,9 @@ bool cpp_typecheckt::operator_is_overloaded(exprt &expr)
645633
if(resolve_result.is_not_nil())
646634
{
647635
// found!
648-
function_call.function()=
649-
static_cast<const exprt &>(
650-
static_cast<const irept &>(cpp_name));
636+
side_effect_expr_function_callt function_call(
637+
cpp_name.as_expr(), {}, typet{}, expr.source_location());
638+
function_call.arguments().reserve(expr.operands().size());
651639

652640
// now do arguments
653641
forall_operands(it, expr)
@@ -904,11 +892,11 @@ void cpp_typecheckt::typecheck_expr_explicit_typecast(exprt &expr)
904892
{
905893
// It's really a function call. Note that multiple arguments
906894
// become a comma expression, and that these are already typechecked.
907-
side_effect_expr_function_callt f_call;
908-
909-
f_call.add_source_location()=expr.source_location();
910-
f_call.function().swap(expr.type());
911-
f_call.arguments()=collect_comma_expression(expr.op0()).operands();
895+
side_effect_expr_function_callt f_call(
896+
std::move(symbol_expr),
897+
collect_comma_expression(expr.op0()).operands(),
898+
typet{},
899+
expr.source_location());
912900

913901
typecheck_side_effect_function_call(f_call);
914902

@@ -2495,10 +2483,8 @@ void cpp_typecheckt::typecheck_side_effect_assignment(side_effect_exprt &expr)
24952483
member.set(ID_component_cpp_name, cpp_name);
24962484
member.add_to_operands(std::move(already_typechecked));
24972485

2498-
side_effect_expr_function_callt new_expr;
2499-
new_expr.function().swap(member);
2500-
new_expr.arguments().push_back(expr.op1());
2501-
new_expr.add_source_location()=expr.source_location();
2486+
side_effect_expr_function_callt new_expr(
2487+
std::move(member), {expr.op1()}, typet{}, expr.source_location());
25022488

25032489
typecheck_side_effect_function_call(new_expr);
25042490

@@ -2565,9 +2551,8 @@ void cpp_typecheckt::typecheck_side_effect_inc_dec(
25652551
member.set(ID_component_cpp_name, cpp_name);
25662552
member.add_to_operands(std::move(already_typechecked));
25672553

2568-
side_effect_expr_function_callt new_expr;
2569-
new_expr.function().swap(member);
2570-
new_expr.add_source_location()=expr.source_location();
2554+
side_effect_expr_function_callt new_expr(
2555+
std::move(member), {}, typet{}, expr.source_location());
25712556

25722557
// the odd C++ way to denote the post-inc/dec operator
25732558
if(post)

src/goto-instrument/goto_program2code.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,13 @@ goto_programt::const_targett goto_program2codet::convert_assign_varargs(
342342
{this_va_list_expr});
343343
f.arguments().back().type().id(ID_gcc_builtin_va_list);
344344

345-
side_effect_expr_function_callt type_of;
346-
type_of.function() =
347-
symbol_exprt("__typeof__", code_typet({}, empty_typet()));
345+
// we do not bother to set the correct types here, they are not relevant for
346+
// generating the correct dumped output
347+
side_effect_expr_function_callt type_of(
348+
symbol_exprt("__typeof__", code_typet({}, empty_typet())),
349+
{},
350+
typet{},
351+
source_locationt{});
348352

349353
// if the return value is used, the next instruction will be assign
350354
goto_programt::const_targett next=target;
@@ -486,9 +490,8 @@ goto_programt::const_targett goto_program2codet::convert_decl(
486490
{
487491
// could hack this by just erasing the first operand
488492
const code_function_callt &f=to_code_function_call(next->code);
489-
side_effect_expr_function_callt call;
490-
call.function()=f.function();
491-
call.arguments()=f.arguments();
493+
side_effect_expr_function_callt call(
494+
f.function(), f.arguments(), typet{}, source_locationt{});
492495
d.copy_to_operands(call);
493496
}
494497

@@ -1935,10 +1938,8 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
19351938
symbol_exprt symbol_expr(symbol.name, symbol.type);
19361939
symbol_expr.add_source_location()=expr.source_location();
19371940

1938-
side_effect_expr_function_callt call;
1939-
call.add_source_location()=expr.source_location();
1940-
call.function()=symbol_expr;
1941-
call.type()=expr.type();
1941+
side_effect_expr_function_callt call(
1942+
symbol_expr, {}, expr.type(), expr.source_location());
19421943

19431944
expr.swap(call);
19441945
}

src/jsil/parser.y

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ instruction: TOK_LABEL TOK_IDENTIFIER
260260
rhs: expression
261261
| proc_ident_expr '(' expressions_opt ')' with_opt
262262
{
263-
side_effect_expr_function_callt f;
264-
f.function().swap(stack($1));
263+
side_effect_expr_function_callt f(stack($1), {}, typet{}, {});
265264
if(stack($3).is_not_nil())
266265
f.arguments().swap(stack($3).operands());
267266

0 commit comments

Comments
 (0)