mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Mangle the signature decl when mangling a thunk. (#7177)
Fixes mangling collisions when two thunks with the same name (eg, `Op`) are created in the same context, which in turn would lead to LLVM verifier failures and miscompiles. To support this, add a new value store to track a little more information about thunks beyond what's in the `Function`.
This commit is contained in:
@@ -263,11 +263,13 @@ auto PerformCallToFunction(Context& context, SemIR::LocId loc_id,
|
||||
switch (callee.special_function_kind) {
|
||||
case SemIR::Function::SpecialFunctionKind::Thunk: {
|
||||
// If we're about to form a direct call to a thunk, inline it.
|
||||
LoadImportRef(context, callee.thunk_decl_id());
|
||||
auto callee_inst_id =
|
||||
context.sem_ir().thunks().Get(callee.thunk_id()).callee_id;
|
||||
LoadImportRef(context, callee_inst_id);
|
||||
|
||||
// Name the thunk target within the enclosing scope of the thunk.
|
||||
auto thunk_ref_id =
|
||||
BuildNameRef(context, loc_id, callee.name_id, callee.thunk_decl_id(),
|
||||
BuildNameRef(context, loc_id, callee.name_id, callee_inst_id,
|
||||
callee_function.enclosing_specific_id);
|
||||
|
||||
auto param_pattern_ids =
|
||||
|
||||
Reference in New Issue
Block a user