@@ -239,7 +239,8 @@ class AbstractBuilder
239
239
protected: // Helpers to add BIR statements
240
240
void push_assignment (PlaceId lhs, AbstractExpr *rhs, location_t location)
241
241
{
242
- ctx.get_current_bb ().statements .emplace_back (lhs, rhs, location);
242
+ ctx.get_current_bb ().statements .push_back (
243
+ Statement::make_assignment (lhs, rhs, location));
243
244
translated = lhs;
244
245
}
245
246
@@ -266,47 +267,46 @@ class AbstractBuilder
266
267
std::initializer_list<BasicBlockId> destinations = {})
267
268
{
268
269
auto copy = move_place (switch_val, location);
269
- ctx.get_current_bb ().statements .emplace_back (Statement::Kind::SWITCH,
270
- copy);
270
+ ctx.get_current_bb ().statements .push_back (Statement::make_switch (copy));
271
271
ctx.get_current_bb ().successors .insert (
272
272
ctx.get_current_bb ().successors .end (), destinations);
273
273
}
274
274
275
275
void push_goto (BasicBlockId bb)
276
276
{
277
- ctx.get_current_bb ().statements .emplace_back (Statement::Kind::GOTO );
277
+ ctx.get_current_bb ().statements .push_back (Statement::make_goto () );
278
278
if (bb != INVALID_BB) // INVALID_BB means the goto will be resolved later.
279
279
ctx.get_current_bb ().successors .push_back (bb);
280
280
}
281
281
282
282
void push_storage_live (PlaceId place)
283
283
{
284
- ctx.get_current_bb ().statements .emplace_back (
285
- Statement::Kind::STORAGE_LIVE, place);
284
+ ctx.get_current_bb ().statements .push_back (
285
+ Statement::make_storage_live ( place) );
286
286
}
287
287
288
288
void push_storage_dead (PlaceId place)
289
289
{
290
- ctx.get_current_bb ().statements .emplace_back (
291
- Statement::Kind::STORAGE_DEAD, place);
290
+ ctx.get_current_bb ().statements .push_back (
291
+ Statement::make_storage_dead ( place) );
292
292
}
293
293
294
294
void push_user_type_ascription (PlaceId place, TyTy::BaseType *ty)
295
295
{
296
- ctx.get_current_bb ().statements .emplace_back (
297
- Statement::Kind::USER_TYPE_ASCRIPTION, place, ty);
296
+ ctx.get_current_bb ().statements .push_back (
297
+ Statement::make_user_type_ascription ( place, ty) );
298
298
}
299
299
300
300
void push_fake_read (PlaceId place)
301
301
{
302
- ctx.get_current_bb ().statements .emplace_back (Statement::Kind::FAKE_READ,
303
- place);
302
+ ctx.get_current_bb ().statements .push_back (
303
+ Statement::make_fake_read ( place) );
304
304
}
305
305
306
306
void push_return (location_t location)
307
307
{
308
- ctx.get_current_bb ().statements .emplace_back (Statement::Kind::RETURN,
309
- INVALID_PLACE, location);
308
+ ctx.get_current_bb ().statements .push_back (
309
+ Statement::make_return ( location) );
310
310
}
311
311
312
312
PlaceId borrow_place (PlaceId place_id, TyTy::BaseType *ty,
0 commit comments