Switch InlineExpr from using IDPList* to vector<IDPtr>

This commit is contained in:
Jon Siwek 2020-12-13 15:04:53 -08:00
parent a0552f9771
commit c7bec09e14
3 changed files with 13 additions and 12 deletions

View file

@ -199,12 +199,14 @@ ExprPtr Inliner::CheckForInlining(IntrusivePtr<CallExpr> c)
// the function, *using the knowledge that the parameters are
// declared first*.
auto scope = func_vf->GetScope();
auto vars = scope->OrderedVars();
auto& vars = scope->OrderedVars();
int nparam = func_vf->GetType()->Params()->NumFields();
auto params = new IDPList;
std::vector<IDPtr> params;
params.reserve(nparam);
for ( int i = 0; i < nparam; ++i )
params->append(vars[i].get());
params.emplace_back(vars[i]);
auto body_dup = body->Duplicate();
@ -229,8 +231,8 @@ ExprPtr Inliner::CheckForInlining(IntrusivePtr<CallExpr> c)
else
max_inlined_frame_size = hold_max_inlined_frame_size;
auto ie = make_intrusive<InlineExpr>(args, params, body_dup,
curr_frame_size, t);
auto ie = make_intrusive<InlineExpr>(args, std::move(params), body_dup,
curr_frame_size, t);
ie->SetOriginal(c);
return ie;