Extend CARBON_KIND_SWITCH to support ArgAndKind (#5216)

This builds on #5212 which is adding ArgAndKind. This further modifies
CARBON_KIND_SWITCH support so that we can use it with ArgAndKind in
addition to Inst. That creates a quirk where it's easier if ArgAndKind
provides `kind` as an accessor instead of a data member, so I'm just
switching it to a class.
This commit is contained in:
Jon Ross-Perkins
2025-03-29 00:37:46 +00:00
committed by GitHub
parent 660d62ecc1
commit 9134e36ec0
10 changed files with 130 additions and 110 deletions
+2 -2
View File
@@ -684,8 +684,8 @@ static auto GetConstantValueForArg(EvalContext& eval_context,
Phase* phase) -> int32_t {
static constexpr auto Table =
MakeArgHandlerTable(static_cast<SemIR::IdKind*>(nullptr));
return Table[arg_and_kind.kind.ToIndex()](eval_context, arg_and_kind.value,
phase);
return Table[arg_and_kind.kind().ToIndex()](eval_context,
arg_and_kind.value(), phase);
}
// Given an instruction, replaces its type and operands with their constant