Change type::fields to return an array_view

This patch changes type::fields to return an array_view of the fields,
then fixes up the fallout.

More cleanups would be possible here (in particular in the field
initialization code) but I haven't done so.

The main motivation for this patch was to make it simpler to iterate
over the fields of a type.

Regression tested on x86-64 Fedora 41.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2025-08-01 11:11:41 -06:00
parent 55c91b7e5c
commit 89495c3326
14 changed files with 115 additions and 139 deletions

View File

@@ -492,7 +492,7 @@ fake_method::fake_method (type_instance_flags flags,
fake_method::~fake_method ()
{
xfree (m_type.fields ());
xfree (m_type.fields ().data ());
}
namespace expr