mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 22:02:51 +01:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user