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 -1
View File
@@ -1294,6 +1294,8 @@ static auto BuildCarbonToCarbonThunk(Context& context, SemIR::LocId loc_id,
thunk_param_type_ids.end());
}
llvm::SmallVector<ParamPatternKind> thunk_param_kinds(
thunk_param_type_ids.size(), ParamPatternKind::Ref);
auto carbon_thunk_function_id =
MakeGeneratedFunctionDecl(
context, loc_id,
@@ -1301,7 +1303,7 @@ static auto BuildCarbonToCarbonThunk(Context& context, SemIR::LocId loc_id,
.name_id = thunk_name_id,
.self_type_id = target.GetSelfTypeId(),
.param_type_ids = thunk_param_type_ids,
.param_kind = ParamPatternKind::Ref})
.param_kinds = thunk_param_kinds})
.second;
BuildThunkDefinitionForExport(