mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor AddInst-family functions to their own file (#4941)
This in particular uses free functions because it's likely to end up more consistent with types (versus a wrapper object for InstStore). Note, this is unlikely to have a performance impact, but if it does, we can look into related approaches (and we've already discussed using LTO). Renames `PendingBlock::AddInst` to `PendingBlock::Add` because `MakeElementAccessInst` expects the matching name to exist.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/eval.h"
|
||||
#include "toolchain/check/generic.h"
|
||||
#include "toolchain/check/inst.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/inst.h"
|
||||
@@ -36,8 +37,8 @@ auto BuildAssociatedEntity(Context& context, SemIR::InterfaceId interface_id,
|
||||
// Name lookup for the declaration's name should name the associated entity,
|
||||
// not the declaration itself.
|
||||
auto type_id = GetAssociatedEntityType(context, self_type_id);
|
||||
return context.AddInst<SemIR::AssociatedEntity>(
|
||||
context.insts().GetLocId(decl_id),
|
||||
return AddInst<SemIR::AssociatedEntity>(
|
||||
context, context.insts().GetLocId(decl_id),
|
||||
{.type_id = type_id, .index = index, .decl_id = decl_id});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user