mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 16:41:06 +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:
@@ -17,6 +17,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/diagnostic_helpers.h"
|
||||
#include "toolchain/check/import.h"
|
||||
#include "toolchain/check/inst.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/diagnostics/diagnostic.h"
|
||||
#include "toolchain/diagnostics/format_providers.h"
|
||||
@@ -105,8 +106,8 @@ static auto AddNamespace(Context& context, PackageNameId cpp_package_id,
|
||||
SemIR::NameScopeId::Package,
|
||||
/*diagnose_duplicate_namespace=*/false,
|
||||
[&]() {
|
||||
return context.AddInst<SemIR::ImportCppDecl>(
|
||||
imports.front().node_id, {});
|
||||
return AddInst<SemIR::ImportCppDecl>(
|
||||
context, imports.front().node_id, {});
|
||||
})
|
||||
.name_scope_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user