| ... | ... | @@ -7905,6 +7905,8 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatu |
| 7905 | 7905 | static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveStatus wanted_resolve_status) { |
| 7906 | 7906 | if (union_type->data.unionation.resolve_status >= wanted_resolve_status) return; |
| 7907 | 7907 | |
| 7908 | bool packed = (union_type->data.unionation.layout == ContainerLayoutPacked); |
| 7909 | |
| 7908 | 7910 | TypeUnionField *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 7909 | 7911 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 7910 | 7912 | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; |
| ... | ... | @@ -7971,9 +7973,9 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7971 | 7973 | most_aligned_union_member->type_entry->llvm_type, |
| 7972 | 7974 | get_llvm_type(g, padding_array), |
| 7973 | 7975 | }; |
| 7974 | | LLVMStructSetBody(union_type->llvm_type, union_element_types, 2, false); |
| 7976 | LLVMStructSetBody(union_type->llvm_type, union_element_types, 2, packed); |
| 7975 | 7977 | } else { |
| 7976 | | LLVMStructSetBody(union_type->llvm_type, &most_aligned_union_member->type_entry->llvm_type, 1, false); |
| 7978 | LLVMStructSetBody(union_type->llvm_type, &most_aligned_union_member->type_entry->llvm_type, 1, packed); |
| 7977 | 7979 | } |
| 7978 | 7980 | union_type->data.unionation.union_llvm_type = union_type->llvm_type; |
| 7979 | 7981 | union_type->data.unionation.gen_tag_index = SIZE_MAX; |
| ... | ... | @@ -8012,7 +8014,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 8012 | 8014 | LLVMTypeRef root_struct_element_types[2]; |
| 8013 | 8015 | root_struct_element_types[union_type->data.unionation.gen_tag_index] = get_llvm_type(g, tag_type); |
| 8014 | 8016 | root_struct_element_types[union_type->data.unionation.gen_union_index] = union_type_ref; |
| 8015 | | LLVMStructSetBody(union_type->llvm_type, root_struct_element_types, 2, false); |
| 8017 | LLVMStructSetBody(union_type->llvm_type, root_struct_element_types, 2, packed); |
| 8016 | 8018 | |
| 8017 | 8019 | // create debug type for union |
| 8018 | 8020 | ZigLLVMDIType *union_di_type = ZigLLVMCreateDebugUnionType(g->dbuilder, |