Use llvm::zip() to iterate over callee_function_params, thunk_function_params and callee_arg_ids (#5940)

This commit is contained in:
Boaz Brickner
2025-08-11 14:57:42 +00:00
committed by GitHub
parent e0de9ddf05
commit fd3eb136af
+7 -9
View File
@@ -328,18 +328,16 @@ auto PerformCppThunkCall(Context& context, SemIR::LocId loc_id,
CARBON_CHECK(thunk_function_params.size() == num_params);
CARBON_CHECK(callee_arg_ids.size() == num_params);
llvm::SmallVector<SemIR::InstId> thunk_arg_ids;
thunk_arg_ids.reserve(callee_arg_ids.size());
for (size_t i = 0; i < callee_function_params.size(); ++i) {
thunk_arg_ids.reserve(num_params);
for (auto [callee_param_inst_id, thunk_param_inst_id, callee_arg_id] :
llvm::zip(callee_function_params, thunk_function_params,
callee_arg_ids)) {
SemIR::TypeId callee_param_type_id =
context.insts()
.GetAs<SemIR::AnyParam>(callee_function_params[i])
.type_id;
context.insts().GetAs<SemIR::AnyParam>(callee_param_inst_id).type_id;
SemIR::TypeId thunk_param_type_id =
context.insts()
.GetAs<SemIR::AnyParam>(thunk_function_params[i])
.type_id;
context.insts().GetAs<SemIR::AnyParam>(thunk_param_inst_id).type_id;
SemIR::InstId arg_id = callee_arg_ids[i];
SemIR::InstId arg_id = callee_arg_id;
if (callee_param_type_id != thunk_param_type_id) {
CARBON_CHECK(thunk_param_type_id ==
GetPointerType(context, context.types().GetInstId(