Provide locations for indirectly imported instructions. (#3811)

This replaces all invalid node IDs in import_ref.cpp with references to
the imported instruction.

This splits out ReplaceInstBeforeConstantUse into a separate function
when the LocationId is replaced, as for splicing. That's the less common
case, whereas others would need to provide the LocationId in order just
to not change the value.
This commit is contained in:
Jon Ross-Perkins
2024-03-27 23:25:41 +00:00
committed by GitHub
parent b079acd86f
commit 1c673041f0
16 changed files with 198 additions and 98 deletions
+1 -2
View File
@@ -198,8 +198,7 @@ static auto BuildFunctionDecl(Context& context,
}
// Write the function ID into the FunctionDecl.
context.ReplaceInstBeforeConstantUse(function_info.decl_id,
{node_id, function_decl});
context.ReplaceInstBeforeConstantUse(function_info.decl_id, function_decl);
if (SemIR::IsEntryPoint(context.sem_ir(), function_decl.function_id)) {
// TODO: Update this once valid signatures for the entry point are decided.