Support arbitrary parameter forms in MakeGeneratedFunctionDecl (#7654)

This allows generated functions to have different forms for different
parameters, and by-ref or by-value return forms. As a byproduct, this
allows generated functions to supply a return type _inst_ ID when they
have one, which preserves things like location information.
This commit is contained in:
Geoff Romer
2026-08-24 21:15:50 +00:00
committed by GitHub
parent 0745bda899
commit 1410795bf7
10 changed files with 146 additions and 132 deletions
+3 -2
View File
@@ -271,8 +271,9 @@ static auto MakeCppStdInitializerListMake(Context& context, SemIR::LocId loc_id,
{.parent_scope_id = init_list_class.scope_id,
.name_id = init_list_class.name_id,
.param_type_ids = {array_type_id},
.param_kind = ParamPatternKind::Value,
.return_type_id = init_list_type_id});
.param_kinds = {ParamPatternKind::Value},
.return_form = ReturnExprAsForm(
context, loc_id, init_list_type_inst_id)});
auto& function = context.functions().Get(function_id);
CARBON_CHECK(IsValidBuiltinDeclaration(