Use const auto references to avoid some copies

This commit is contained in:
Tim Wojtulewicz 2025-04-04 16:22:56 -07:00
parent 739efc79be
commit f7495831a2
5 changed files with 8 additions and 8 deletions

View file

@ -1053,13 +1053,13 @@ string CPPCompile::GenDirectAssign(const ExprPtr& lhs, const string& rhs_native,
if ( n->IsBlank() )
return rhs_native;
auto name = IDNameStr(n);
const auto& name = IDNameStr(n);
string gen;
if ( n->IsGlobal() ) {
const auto& t = n->GetType();
auto gn = globals[n->Name()];
const auto& gn = globals[n->Name()];
if ( t->Tag() == TYPE_FUNC && t->AsFuncType()->Flavor() == FUNC_FLAVOR_EVENT ) {
gen = string("set_event__CPP(") + gn + ", " + rhs_val_ptr + ", " + gn + "_ev)";