Reduce explicit SemIR::LocIdAndInst construction (#5153)

Building on #5151 reducing `UncheckedLoc` use, further remove uses of
the `SemIR::LocIdAndInst` constructor where we typically have overloads
that don't need it. Add parallel convenience wrappers for placeholder
insts.

Also refactors `MergeReplacing`. I don't think it makes sense to add an
overload for `ReplaceLocIdAndInstBeforeConstantUse`, but we can still
reduce the `LocIdAndInst` construction there.
This commit is contained in:
Jon Ross-Perkins
2025-03-21 21:45:53 +00:00
committed by GitHub
parent 402dc2c064
commit 832c6398d6
12 changed files with 78 additions and 94 deletions
+2 -2
View File
@@ -226,8 +226,8 @@ static auto ImportFunctionDecl(Context& context, SemIR::LocId loc_id,
auto function_decl = SemIR::FunctionDecl{
SemIR::TypeId::None, SemIR::FunctionId::None, SemIR::InstBlockId::Empty};
auto decl_id = AddPlaceholderInst(
context, SemIR::LocIdAndInst(Parse::NodeId::None, function_decl));
auto decl_id =
AddPlaceholderInst(context, Parse::NodeId::None, function_decl);
auto function_info = SemIR::Function{
{.name_id = name_id,