mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
remove ResultLocField dead code
This commit is contained in:
parent
771e88951a
commit
3ec766abe3
@ -3588,7 +3588,6 @@ enum ResultLocId {
|
||||
ResultLocIdInvalid,
|
||||
ResultLocIdNone,
|
||||
ResultLocIdVar,
|
||||
ResultLocIdField,
|
||||
ResultLocIdReturn,
|
||||
ResultLocIdPeer,
|
||||
ResultLocIdPeerParent,
|
||||
@ -3615,14 +3614,6 @@ struct ResultLocVar {
|
||||
ZigVar *var;
|
||||
};
|
||||
|
||||
struct ResultLocField {
|
||||
ResultLoc base;
|
||||
|
||||
ResultLoc *parent;
|
||||
Buf *name;
|
||||
IrInstruction *container_type;
|
||||
};
|
||||
|
||||
struct ResultLocReturn {
|
||||
ResultLoc base;
|
||||
};
|
||||
|
||||
42
src/ir.cpp
42
src/ir.cpp
@ -14504,28 +14504,6 @@ static ZigType *ir_result_loc_expected_type(IrAnalyze *ira, IrInstruction *suspe
|
||||
return nullptr;
|
||||
case ResultLocIdInstruction:
|
||||
return result_loc->source_instruction->child->value.type;
|
||||
case ResultLocIdField: {
|
||||
if (result_loc->resolved_loc != nullptr) {
|
||||
ZigType *ptr_type = result_loc->resolved_loc->value.type;
|
||||
assert(ptr_type->id == ZigTypeIdPointer);
|
||||
return ptr_type->data.pointer.child_type;
|
||||
}
|
||||
ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc);
|
||||
ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child);
|
||||
if (type_is_invalid(container_type))
|
||||
return ira->codegen->builtin_types.entry_invalid;
|
||||
if (container_type->id == ZigTypeIdStruct) {
|
||||
TypeStructField *field = find_struct_type_field(container_type, result_loc_field->name);
|
||||
if (field == nullptr) {
|
||||
return ira->codegen->builtin_types.entry_invalid;
|
||||
}
|
||||
return field->type_entry;
|
||||
} else if (container_type->id == ZigTypeIdUnion) {
|
||||
zig_panic("TODO");
|
||||
} else {
|
||||
zig_unreachable();
|
||||
}
|
||||
}
|
||||
case ResultLocIdReturn:
|
||||
return ira->explicit_return_type;
|
||||
case ResultLocIdPeer:
|
||||
@ -14606,26 +14584,6 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s
|
||||
result_loc->resolved_loc = result_loc->source_instruction->child;
|
||||
return result_loc->resolved_loc;
|
||||
}
|
||||
case ResultLocIdField: {
|
||||
ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc);
|
||||
|
||||
ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child);
|
||||
if (type_is_invalid(container_type))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
||||
IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr,
|
||||
result_loc_field->parent, container_type, nullptr);
|
||||
if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) ||
|
||||
parent_result_loc->value.type->id == ZigTypeIdUnreachable)
|
||||
{
|
||||
return parent_result_loc;
|
||||
}
|
||||
|
||||
result_loc->written = true;
|
||||
result_loc->resolved_loc = ir_analyze_container_field_ptr(ira, result_loc_field->name,
|
||||
suspend_source_instr, parent_result_loc, container_type);
|
||||
return result_loc->resolved_loc;
|
||||
}
|
||||
case ResultLocIdReturn: {
|
||||
bool is_comptime = value != nullptr && value->value.special != ConstValSpecialRuntime;
|
||||
if (is_comptime) return nullptr;
|
||||
|
||||
@ -213,12 +213,6 @@ static void ir_print_result_loc_instruction(IrPrint *irp, ResultLocInstruction *
|
||||
fprintf(irp->f, ")");
|
||||
}
|
||||
|
||||
static void ir_print_result_loc_field(IrPrint *irp, ResultLocField *result_loc_field) {
|
||||
fprintf(irp->f, "field(name=%s,type=", buf_ptr(result_loc_field->name));
|
||||
ir_print_other_instruction(irp, result_loc_field->container_type);
|
||||
fprintf(irp->f, ")");
|
||||
}
|
||||
|
||||
static void ir_print_result_loc_peer(IrPrint *irp, ResultLocPeer *result_loc_peer) {
|
||||
fprintf(irp->f, "peer(next=");
|
||||
ir_print_other_block(irp, result_loc_peer->next_bb);
|
||||
@ -239,8 +233,6 @@ static void ir_print_result_loc(IrPrint *irp, ResultLoc *result_loc) {
|
||||
return ir_print_result_loc_var(irp, (ResultLocVar *)result_loc);
|
||||
case ResultLocIdInstruction:
|
||||
return ir_print_result_loc_instruction(irp, (ResultLocInstruction *)result_loc);
|
||||
case ResultLocIdField:
|
||||
return ir_print_result_loc_field(irp, (ResultLocField *)result_loc);
|
||||
case ResultLocIdPeer:
|
||||
return ir_print_result_loc_peer(irp, (ResultLocPeer *)result_loc);
|
||||
case ResultLocIdPeerParent:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user