Avoid creating a few temporary values to avoid copy operations

This commit is contained in:
Tim Wojtulewicz 2023-11-27 11:23:07 -07:00
parent 3295c8f1c1
commit 1e33467844
3 changed files with 3 additions and 7 deletions

View file

@ -1052,8 +1052,7 @@ void RecordType::AddField(unsigned int field, const TypeDecl* td) {
if ( def_expr && ! IsErrorType(type->Tag()) ) {
if ( def_expr->Tag() == detail::EXPR_CONST ) {
auto v = def_expr->Eval(nullptr);
auto zv = ZVal(v, type);
auto zv = ZVal(def_expr->Eval(nullptr), type);
if ( ZVal::IsManagedType(type) )
init = std::make_unique<detail::DirectManagedFieldInit>(zv);