Repository: carbon-language/carbon-lang
File: toolchain/sem_ir/function.h (C/C++)

Code before:
  // The specific for the callee itself, in a resolved call.
  SpecificId resolved_specific_id;
  // The bound `Self` type or facet value. `None` if not a bound interface
  // member.
  InstId self_type_id;
  // The bound `self` parameter. `None` if not a method.
  InstId self_id;
  // True if an error instruction was found.
  bool is_error;

  auto Print(llvm::raw_ostream& out) const -> void {
    out << "{function_id: " << function_id
        << ", enclosing_specific_id: " << enclosing_specific_id
        << ", resolved_specific_id: " << resolved_specific_id
        << ", self_type_id: " << self_type_id << ", self_id: " << self_id
        << ", is_error: " << is_error << "}";
  }
};

// Returns information for the function corresponding to callee_id.
auto GetCalleeFunction(const File& sem_ir, InstId callee_id,
                       SpecificId specific_id = SpecificId::None)
    -> CalleeFunction;

struct DecomposedVirtualFunction {
  // The canonical instruction.
  InstId fn_decl_id;
  // The constant for the underlying instruction.
  ConstantId fn_decl_const_id;
  // The function.
  FunctionId function_id;
  // The specific for the function.
  SpecificId specific_id;
};

// Returns information for the virtual function table entry instruction.
auto DecomposeVirtualFunction(const File& sem_ir, InstId fn_decl_id,
                              SpecificId base_class_specific_id)
    -> DecomposedVirtualFunction;

}  // namespace Carbon::SemIR

#endif  // CARBON_TOOLCHAIN_SEM_IR_FUNCTION_H_


Review comment (suggestion):
```suggestion
  // The canonical instruction from the `fn_decl_const_id`.
```

Code after:
  // The specific for the callee itself, in a resolved call.
  SpecificId resolved_specific_id;
  // The bound `Self` type or facet value. `None` if not a bound interface
  // member.
  InstId self_type_id;
  // The bound `self` parameter. `None` if not a method.
  InstId self_id;
  // True if an error instruction was found.
  bool is_error;

  auto Print(llvm::raw_ostream& out) const -> void {
    out << "{function_id: " << function_id
        << ", enclosing_specific_id: " << enclosing_specific_id
        << ", resolved_specific_id: " << resolved_specific_id
        << ", self_type_id: " << self_type_id << ", self_id: " << self_id
        << ", is_error: " << is_error << "}";
  }
};

// Returns information for the function corresponding to callee_id.
auto GetCalleeFunction(const File& sem_ir, InstId callee_id,
                       SpecificId specific_id = SpecificId::None)
    -> CalleeFunction;

struct DecomposedVirtualFunction {
  // The canonical instruction from the `fn_decl_const_id`.
  InstId fn_decl_id;
  // The constant for the underlying instruction.
  ConstantId fn_decl_const_id;
  // The function.
  FunctionId function_id;
  // The specific for the function.
  SpecificId specific_id;
};

// Returns information for the virtual function table entry instruction.
auto DecomposeVirtualFunction(const File& sem_ir, InstId fn_decl_id,
                              SpecificId base_class_specific_id)
    -> DecomposedVirtualFunction;

}  // namespace Carbon::SemIR

#endif  // CARBON_TOOLCHAIN_SEM_IR_FUNCTION_H_