| ... | ... | @@ -2633,7 +2633,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { |
| 2633 | 2633 | decl_node->data.container_decl.init_arg_expr != nullptr) |
| 2634 | 2634 | { |
| 2635 | 2635 | union_field->type_entry = g->builtin_types.entry_void; |
| 2636 | | field_is_zero_bits = false; |
| 2636 | field_is_zero_bits = true; |
| 2637 | 2637 | } else { |
| 2638 | 2638 | add_node_error(g, field_node, buf_sprintf("union field missing type")); |
| 2639 | 2639 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| ... | ... | @@ -5593,6 +5593,10 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { |
| 5593 | 5593 | |
| 5594 | 5594 | static Error resolve_pointer_zero_bits(CodeGen *g, ZigType *ty) { |
| 5595 | 5595 | Error err; |
| 5596 | |
| 5597 | if (ty->abi_size != SIZE_MAX) |
| 5598 | return ErrorNone; |
| 5599 | |
| 5596 | 5600 | ZigType *elem_type = ty->data.pointer.child_type; |
| 5597 | 5601 | |
| 5598 | 5602 | if ((err = type_resolve(g, elem_type, ResolveStatusZeroBitsKnown))) |
| ... | ... | @@ -5641,6 +5645,8 @@ Error type_resolve(CodeGen *g, ZigType *ty, ResolveStatus status) { |
| 5641 | 5645 | return resolve_union_alignment(g, ty); |
| 5642 | 5646 | case ZigTypeIdFnFrame: |
| 5643 | 5647 | return resolve_async_frame(g, ty); |
| 5648 | case ZigTypeIdPointer: |
| 5649 | return resolve_pointer_zero_bits(g, ty); |
| 5644 | 5650 | default: |
| 5645 | 5651 | return ErrorNone; |
| 5646 | 5652 | } |
| ... | ... | @@ -5654,6 +5660,8 @@ Error type_resolve(CodeGen *g, ZigType *ty, ResolveStatus status) { |
| 5654 | 5660 | return resolve_union_type(g, ty); |
| 5655 | 5661 | case ZigTypeIdFnFrame: |
| 5656 | 5662 | return resolve_async_frame(g, ty); |
| 5663 | case ZigTypeIdPointer: |
| 5664 | return resolve_pointer_zero_bits(g, ty); |
| 5657 | 5665 | default: |
| 5658 | 5666 | return ErrorNone; |
| 5659 | 5667 | } |
| ... | ... | @@ -7386,7 +7394,8 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7386 | 7394 | |
| 7387 | 7395 | TypeUnionField *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 7388 | 7396 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 7389 | | if (most_aligned_union_member == nullptr) { |
| 7397 | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; |
| 7398 | if (gen_field_count == 0) { |
| 7390 | 7399 | union_type->llvm_type = get_llvm_type(g, tag_type); |
| 7391 | 7400 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); |
| 7392 | 7401 | union_type->data.unionation.resolve_status = ResolveStatusLLVMFull; |
| ... | ... | @@ -7410,7 +7419,6 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7410 | 7419 | if (ResolveStatusLLVMFwdDecl >= wanted_resolve_status) return; |
| 7411 | 7420 | } |
| 7412 | 7421 | |
| 7413 | | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; |
| 7414 | 7422 | ZigLLVMDIType **union_inner_di_types = allocate<ZigLLVMDIType*>(gen_field_count); |
| 7415 | 7423 | uint32_t field_count = union_type->data.unionation.src_field_count; |
| 7416 | 7424 | for (uint32_t i = 0; i < field_count; i += 1) { |
| ... | ... | @@ -7541,6 +7549,9 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7541 | 7549 | static void resolve_llvm_types_pointer(CodeGen *g, ZigType *type, ResolveStatus wanted_resolve_status) { |
| 7542 | 7550 | if (type->llvm_di_type != nullptr) return; |
| 7543 | 7551 | |
| 7552 | if (resolve_pointer_zero_bits(g, type) != ErrorNone) |
| 7553 | zig_unreachable(); |
| 7554 | |
| 7544 | 7555 | if (!type_has_bits(type)) { |
| 7545 | 7556 | type->llvm_type = g->builtin_types.entry_void->llvm_type; |
| 7546 | 7557 | type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type; |