Move diagnostic helpers from Context to other files (#4949)

Trying to find more specific homes for shared diagnostic function calls.
This commit is contained in:
Jon Ross-Perkins
2025-02-13 18:08:11 +00:00
committed by GitHub
parent 6dda094928
commit e70f9cd71d
14 changed files with 130 additions and 121 deletions
+4 -3
View File
@@ -9,6 +9,7 @@
#include "toolchain/check/merge.h"
#include "toolchain/check/modifiers.h"
#include "toolchain/check/name_component.h"
#include "toolchain/check/name_lookup.h"
#include "toolchain/sem_ir/typed_insts.h"
namespace Carbon::Check {
@@ -65,8 +66,8 @@ static auto BuildInterfaceDecl(Context& context,
introducer.modifier_set.GetAccessKind());
if (lookup_result.is_poisoned()) {
// This is a declaration of a poisoned name.
context.DiagnosePoisonedName(lookup_result.poisoning_loc_id(),
name_context.loc_id);
DiagnosePoisonedName(context, lookup_result.poisoning_loc_id(),
name_context.loc_id);
} else if (lookup_result.is_found()) {
SemIR::InstId existing_id = lookup_result.target_inst_id();
if (auto existing_interface_decl =
@@ -102,7 +103,7 @@ static auto BuildInterfaceDecl(Context& context,
}
} else {
// This is a redeclaration of something other than a interface.
context.DiagnoseDuplicateName(interface_decl_id, existing_id);
DiagnoseDuplicateName(context, interface_decl_id, existing_id);
}
}