File tree 3 files changed +10
-17
lines changed
3 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -349,12 +349,7 @@ void cpp_typecheckt::default_assignop_value(
349
349
source_locationt source_location=declarator.source_location ();
350
350
declarator.make_nil ();
351
351
352
- declarator.value ().add_source_location ()=source_location;
353
- declarator.value ().id (ID_code);
354
- declarator.value ().set (ID_statement, ID_block);
355
- declarator.value ().type () = code_typet ({}, empty_typet ());
356
-
357
- exprt &block=declarator.value ();
352
+ code_blockt block;
358
353
359
354
std::string arg_name (" ref" );
360
355
@@ -405,12 +400,11 @@ void cpp_typecheckt::default_assignop_value(
405
400
}
406
401
407
402
// Finally we add the return statement
408
- block.operands ().push_back (exprt (ID_code));
409
- exprt &ret_code=declarator.value ().operands ().back ();
410
- ret_code.operands ().push_back (exprt (ID_dereference));
411
- ret_code.op0 ().operands ().push_back (exprt (" cpp-this" ));
412
- ret_code.set (ID_statement, ID_return);
413
- ret_code.type () = code_typet ({}, empty_typet ());
403
+ block.add (
404
+ code_returnt (dereference_exprt (exprt (" cpp-this" ), uninitialized_typet ())));
405
+
406
+ declarator.value () = std::move (block);
407
+ declarator.value ().add_source_location () = source_location;
414
408
}
415
409
416
410
// / Check a constructor initialization-list. An initializer has to be a data
Original file line number Diff line number Diff line change @@ -1963,8 +1963,8 @@ void cpp_typecheckt::typecheck_side_effect_function_call(
1963
1963
else if (expr.function ().id () == ID_cpp_dummy_destructor)
1964
1964
{
1965
1965
// these don't do anything, e.g., (char*)->~char()
1966
- expr. set (ID_statement, ID_skip );
1967
- expr.type ()= empty_typet ( );
1966
+ typecast_exprt no_op ( from_integer ( 0 , signed_int_type ()), void_type () );
1967
+ expr.swap (no_op );
1968
1968
return ;
1969
1969
}
1970
1970
Original file line number Diff line number Diff line change @@ -198,9 +198,8 @@ statements_opt: /* empty */
198
198
199
199
statements : statement
200
200
{
201
- newstack ($$).id(ID_code);
202
- to_code (stack($$)).set_statement(ID_block);
203
- stack ($$).add_to_operands(std::move(stack($1 )));
201
+ code_blockt b ({static_cast <codet &>(stack ($1 ))});
202
+ newstack ($$).swap(b);
204
203
}
205
204
| statements statement
206
205
{
You can’t perform that action at this time.
0 commit comments