mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Add MakeVerifiedLocIdAndInst for runtime validation (#6942)
This follows up on a discussion about wanting to use `Any*` inst clusters to handle boilerplate construction, with the issue that `UncheckedLoc` use removes validation. Some context is at https://github.com/carbon-language/carbon-lang/pull/6930#discussion_r2963157428. This folds in `MakeImportedLocIdAndInst` because the logic is related, particularly for `LocId` values which are `ImportIRInstId`, and it eliminates questions of what the right function is to use. This uncovers an error in the `NodeKind` associated with `FormBindingPattern`. For now I'm just adding a TODO regarding that. Assisted-by: Google Antigravity with Gemini
This commit is contained in:
@@ -454,7 +454,8 @@ auto MakeFunctionDecl(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::FunctionDecl function_decl = {SemIR::TypeId::None,
|
||||
SemIR::FunctionId::None, decl_block_id};
|
||||
auto decl_id = AddPlaceholderInstInNoBlock(
|
||||
context, SemIR::LocIdAndInst::UncheckedLoc(loc_id, function_decl));
|
||||
context, SemIR::LocIdAndInst::RuntimeVerified(context.sem_ir(), loc_id,
|
||||
function_decl));
|
||||
function.first_owning_decl_id = decl_id;
|
||||
if (is_definition) {
|
||||
function.definition_id = decl_id;
|
||||
|
||||
Reference in New Issue
Block a user