mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor ReturnTypeInfo and InitRepr. (#4169)
Rename `ReturnInfo` to `ReturnTypeInfo`. Move it and `InitRepr` into `type_info.h` alongside `ValueRepr`. Replace `ReturnSlot` with `InitRepr`, and extend `InitRepr` to be able to represent the incomplete-type case instead of CHECK-failing. Remove `has_return_slot` from `InitRepr` and instead only provide that as part of `ReturnTypeInfo`.
This commit is contained in:
@@ -312,14 +312,15 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
|
||||
|
||||
std::vector<llvm::Value*> args;
|
||||
|
||||
if (SemIR::GetInitRepr(context.sem_ir(), inst.type_id).has_return_slot()) {
|
||||
if (SemIR::ReturnTypeInfo::ForType(context.sem_ir(), inst.type_id)
|
||||
.has_return_slot()) {
|
||||
args.push_back(context.GetValue(arg_ids.back()));
|
||||
arg_ids = arg_ids.drop_back();
|
||||
}
|
||||
|
||||
for (auto arg_id : arg_ids) {
|
||||
auto arg_type_id = context.sem_ir().insts().Get(arg_id).type_id();
|
||||
if (SemIR::GetValueRepr(context.sem_ir(), arg_type_id).kind !=
|
||||
if (SemIR::ValueRepr::ForType(context.sem_ir(), arg_type_id).kind !=
|
||||
SemIR::ValueRepr::None) {
|
||||
args.push_back(context.GetValue(arg_id));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user