mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:24:41 +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:
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/decl_name_stack.h"
|
||||
#include "toolchain/check/handle.h"
|
||||
#include "toolchain/check/inst.h"
|
||||
#include "toolchain/check/modifiers.h"
|
||||
#include "toolchain/check/name_component.h"
|
||||
#include "toolchain/check/name_lookup.h"
|
||||
@@ -69,10 +70,11 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto export_id = context.AddInst<SemIR::ExportDecl>(
|
||||
node_id, {.type_id = import_ref->type_id,
|
||||
.entity_name_id = import_ref->entity_name_id,
|
||||
.value_id = inst_id});
|
||||
auto export_id =
|
||||
AddInst<SemIR::ExportDecl>(context, node_id,
|
||||
{.type_id = import_ref->type_id,
|
||||
.entity_name_id = import_ref->entity_name_id,
|
||||
.value_id = inst_id});
|
||||
context.AddExport(export_id);
|
||||
|
||||
// Replace the ImportRef in name lookup, both for the above duplicate
|
||||
|
||||
Reference in New Issue
Block a user