Store the CppOverloadSetId on CalleeFunction. (#6067)

This commit is contained in:
Richard Smith
2025-09-15 21:58:55 +00:00
committed by GitHub
parent ccca7f3bab
commit 0cafb8f0e4
5 changed files with 21 additions and 26 deletions
+4 -5
View File
@@ -16,12 +16,12 @@ namespace Carbon::SemIR {
auto GetCalleeFunction(const File& sem_ir, InstId callee_id,
SpecificId specific_id) -> CalleeFunction {
CalleeFunction result = {.function_id = FunctionId::None,
.cpp_overload_set_id = CppOverloadSetId::None,
.enclosing_specific_id = SpecificId::None,
.resolved_specific_id = SpecificId::None,
.self_type_id = InstId::None,
.self_id = InstId::None,
.is_error = false,
.is_cpp_overload_set = false};
.is_error = false};
if (auto bound_method = sem_ir.insts().TryGetAs<BoundMethod>(callee_id)) {
result.self_id = bound_method->object_id;
callee_id = bound_method->function_decl_id;
@@ -48,9 +48,8 @@ auto GetCalleeFunction(const File& sem_ir, InstId callee_id,
auto fn_type_inst =
sem_ir.types().GetAsInst(sem_ir.insts().Get(val_id).type_id());
if (fn_type_inst.TryAs<CppOverloadSetType>()) {
// TODO: Consider evaluating this at runtime instead of having a field.
result.is_cpp_overload_set = true;
if (auto cpp_overload_set_type = fn_type_inst.TryAs<CppOverloadSetType>()) {
result.cpp_overload_set_id = cpp_overload_set_type->overload_set_id;
return result;
}