authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-02 18:43:25-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-02 18:43:25-04:00
log15bd4aa54fcebc9f8296be6138c7775f23082746
tree53fe8f61a8a676748c4ab4aa6458341403ea07a4
parente9dc504141a18e315fe547c54885811927608319

fix setting union body twice


1 files changed, 4 insertions(+), 3 deletions(-)

src/analyze.cpp+4-3
...@@ -6653,6 +6653,9 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta...@@ -6653,6 +6653,9 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
6653 if (!type_has_bits(union_field->type_entry))6653 if (!type_has_bits(union_field->type_entry))
6654 continue;6654 continue;
66556655
6656 ZigLLVMDIType *field_di_type = get_llvm_di_type(g, union_field->type_entry);
6657 if (union_type->data.unionation.resolve_status >= wanted_resolve_status) return;
6658
6656 uint64_t store_size_in_bits = union_field->type_entry->size_in_bits;6659 uint64_t store_size_in_bits = union_field->type_entry->size_in_bits;
6657 uint64_t abi_align_in_bits = 8*union_field->type_entry->abi_align;6660 uint64_t abi_align_in_bits = 8*union_field->type_entry->abi_align;
6658 AstNode *field_node = decl_node->data.container_decl.fields.at(i);6661 AstNode *field_node = decl_node->data.container_decl.fields.at(i);
...@@ -6662,7 +6665,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta...@@ -6662,7 +6665,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
6662 store_size_in_bits,6665 store_size_in_bits,
6663 abi_align_in_bits,6666 abi_align_in_bits,
6664 0,6667 0,
6665 0, get_llvm_di_type(g, union_field->type_entry));6668 0, field_di_type);
66666669
6667 }6670 }
66686671
...@@ -6670,8 +6673,6 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta...@@ -6670,8 +6673,6 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
6670 assert(most_aligned_union_member != nullptr);6673 assert(most_aligned_union_member != nullptr);
66716674
6672 size_t padding_bytes = union_type->data.unionation.union_abi_size - most_aligned_union_member->abi_size;6675 size_t padding_bytes = union_type->data.unionation.union_abi_size - most_aligned_union_member->abi_size;
6673 (void)get_llvm_type(g, most_aligned_union_member);
6674 if (union_type->data.unionation.resolve_status >= wanted_resolve_status) return;
6675 if (padding_bytes > 0) {6676 if (padding_bytes > 0) {
6676 ZigType *u8_type = get_int_type(g, false, 8);6677 ZigType *u8_type = get_int_type(g, false, 8);
6677 ZigType *padding_array = get_array_type(g, u8_type, padding_bytes);6678 ZigType *padding_array = get_array_type(g, u8_type, padding_bytes);