mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:00:13 +01:00
When making a direct call to a thunk, inline the call in SemIR. (#5642)
This preserves the constant values of the arguments to the thunk, which is important if the thunk requires conversion of an `IntLiteral` to some other type. This should become unnecessary once we have form support, but avoiding the indirection through a thunk function seems valuable even once that support is in place. To support this, track whether a function is a thunk on the Function object, and if so, what the callee of the thunk is. This information is also included in formatted SemIR when dumping the thunk.
This commit is contained in:
@@ -727,7 +727,7 @@ auto HandleParseNode(Context& context,
|
||||
|
||||
auto& function = context.functions().Get(function_id);
|
||||
if (IsValidBuiltinDeclaration(context, function, builtin_kind)) {
|
||||
function.builtin_function_kind = builtin_kind;
|
||||
function.SetBuiltinFunction(builtin_kind);
|
||||
// Build an empty generic definition if this is a generic builtin.
|
||||
StartGenericDefinition(context, function.generic_id);
|
||||
FinishGenericDefinition(context, function.generic_id);
|
||||
|
||||
Reference in New Issue
Block a user