| ... | @@ -343,8 +343,9 @@ ZigType *get_promise_type(CodeGen *g, ZigType *result_type) { | ... | @@ -343,8 +343,9 @@ ZigType *get_promise_type(CodeGen *g, ZigType *result_type) { |
| 343 | } | 343 | } |
| 344 | | 344 | |
| 345 | ZigType *entry = new_type_table_entry(ZigTypeIdPromise); | 345 | ZigType *entry = new_type_table_entry(ZigTypeIdPromise); |
| 346 | entry->abi_size = g->pointer_size_bytes; | 346 | entry->abi_size = g->builtin_types.entry_usize->abi_size; |
| 347 | entry->size_in_bits = g->pointer_size_bytes * 8; | 347 | entry->size_in_bits = g->builtin_types.entry_usize->size_in_bits; |
| | 348 | entry->abi_align = g->builtin_types.entry_usize->abi_align; |
| 348 | entry->data.promise.result_type = result_type; | 349 | entry->data.promise.result_type = result_type; |
| 349 | buf_init_from_str(&entry->name, "promise"); | 350 | buf_init_from_str(&entry->name, "promise"); |
| 350 | if (result_type != nullptr) { | 351 | if (result_type != nullptr) { |
| ... | @@ -775,9 +776,6 @@ ZigType *get_bound_fn_type(CodeGen *g, ZigFn *fn_entry) { | ... | @@ -775,9 +776,6 @@ ZigType *get_bound_fn_type(CodeGen *g, ZigFn *fn_entry) { |
| 775 | | 776 | |
| 776 | ZigType *bound_fn_type = new_type_table_entry(ZigTypeIdBoundFn); | 777 | ZigType *bound_fn_type = new_type_table_entry(ZigTypeIdBoundFn); |
| 777 | bound_fn_type->data.bound_fn.fn_type = fn_type; | 778 | bound_fn_type->data.bound_fn.fn_type = fn_type; |
| 778 | bound_fn_type->abi_size = 0; | | |
| 779 | bound_fn_type->size_in_bits = 0; | | |
| 780 | bound_fn_type->abi_align = 0; | | |
| 781 | | 779 | |
| 782 | buf_resize(&bound_fn_type->name, 0); | 780 | buf_resize(&bound_fn_type->name, 0); |
| 783 | buf_appendf(&bound_fn_type->name, "(bound %s)", buf_ptr(&fn_type->name)); | 781 | buf_appendf(&bound_fn_type->name, "(bound %s)", buf_ptr(&fn_type->name)); |
| ... | @@ -1248,6 +1246,9 @@ ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) { | ... | @@ -1248,6 +1246,9 @@ ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) { |
| 1248 | err_set_type->data.error_set.err_count = 0; | 1246 | err_set_type->data.error_set.err_count = 0; |
| 1249 | err_set_type->data.error_set.errors = nullptr; | 1247 | err_set_type->data.error_set.errors = nullptr; |
| 1250 | err_set_type->data.error_set.infer_fn = fn_entry; | 1248 | err_set_type->data.error_set.infer_fn = fn_entry; |
| | 1249 | err_set_type->size_in_bits = g->builtin_types.entry_global_error_set->size_in_bits; |
| | 1250 | err_set_type->abi_align = g->builtin_types.entry_global_error_set->abi_align; |
| | 1251 | err_set_type->abi_size = g->builtin_types.entry_global_error_set->abi_size; |
| 1251 | | 1252 | |
| 1252 | return err_set_type; | 1253 | return err_set_type; |
| 1253 | } | 1254 | } |
| ... | @@ -1597,7 +1598,16 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) { | ... | @@ -1597,7 +1598,16 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) { |
| 1597 | | 1598 | |
| 1598 | uint32_t *host_int_bytes = packed ? allocate<uint32_t>(struct_type->data.structure.gen_field_count) : nullptr; | 1599 | uint32_t *host_int_bytes = packed ? allocate<uint32_t>(struct_type->data.structure.gen_field_count) : nullptr; |
| 1599 | | 1600 | |
| 1600 | // Compute offsets for all the fields. | 1601 | // Resolve sizes of all the field types. Done before the offset loop because the offset |
| | 1602 | // loop has to look ahead. |
| | 1603 | for (size_t i = 0; i < field_count; i += 1) { |
| | 1604 | TypeStructField *field = &struct_type->data.structure.fields[i]; |
| | 1605 | if ((err = type_resolve(g, field->type_entry, ResolveStatusSizeKnown))) { |
| | 1606 | struct_type->data.structure.resolve_status = ResolveStatusInvalid; |
| | 1607 | return ErrorSemanticAnalyzeFail; |
| | 1608 | } |
| | 1609 | } |
| | 1610 | |
| 1601 | size_t packed_bits_offset = 0; | 1611 | size_t packed_bits_offset = 0; |
| 1602 | size_t next_offset = 0; | 1612 | size_t next_offset = 0; |
| 1603 | size_t first_packed_bits_offset_misalign = SIZE_MAX; | 1613 | size_t first_packed_bits_offset_misalign = SIZE_MAX; |
| ... | @@ -1739,6 +1749,7 @@ static Error resolve_union_alignment(CodeGen *g, ZigType *union_type) { | ... | @@ -1739,6 +1749,7 @@ static Error resolve_union_alignment(CodeGen *g, ZigType *union_type) { |
| 1739 | // unset temporary flag | 1749 | // unset temporary flag |
| 1740 | union_type->data.unionation.resolve_loop_flag = false; | 1750 | union_type->data.unionation.resolve_loop_flag = false; |
| 1741 | union_type->data.unionation.resolve_status = ResolveStatusAlignmentKnown; | 1751 | union_type->data.unionation.resolve_status = ResolveStatusAlignmentKnown; |
| | 1752 | union_type->data.unionation.most_aligned_union_member = most_aligned_union_member; |
| 1742 | | 1753 | |
| 1743 | ZigType *tag_type = union_type->data.unionation.tag_type; | 1754 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 1744 | if (tag_type != nullptr && type_has_bits(tag_type)) { | 1755 | if (tag_type != nullptr && type_has_bits(tag_type)) { |
| ... | @@ -1788,6 +1799,7 @@ static Error resolve_union_type(CodeGen *g, ZigType *union_type) { | ... | @@ -1788,6 +1799,7 @@ static Error resolve_union_type(CodeGen *g, ZigType *union_type) { |
| 1788 | assert(decl_node->type == NodeTypeContainerDecl); | 1799 | assert(decl_node->type == NodeTypeContainerDecl); |
| 1789 | | 1800 | |
| 1790 | uint32_t field_count = union_type->data.unionation.src_field_count; | 1801 | uint32_t field_count = union_type->data.unionation.src_field_count; |
| | 1802 | ZigType *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 1791 | | 1803 | |
| 1792 | assert(union_type->data.unionation.fields); | 1804 | assert(union_type->data.unionation.fields); |
| 1793 | | 1805 | |
| ... | @@ -1827,13 +1839,18 @@ static Error resolve_union_type(CodeGen *g, ZigType *union_type) { | ... | @@ -1827,13 +1839,18 @@ static Error resolve_union_type(CodeGen *g, ZigType *union_type) { |
| 1827 | union_size_in_bits = max(union_size_in_bits, field_type->size_in_bits); | 1839 | union_size_in_bits = max(union_size_in_bits, field_type->size_in_bits); |
| 1828 | } | 1840 | } |
| 1829 | | 1841 | |
| | 1842 | // The union itself for now has to be treated as being independently aligned. |
| | 1843 | // See https://github.com/ziglang/zig/issues/2166. |
| | 1844 | if (most_aligned_union_member != nullptr) { |
| | 1845 | union_abi_size = align_forward(union_abi_size, most_aligned_union_member->abi_align); |
| | 1846 | } |
| | 1847 | |
| 1830 | // unset temporary flag | 1848 | // unset temporary flag |
| 1831 | union_type->data.unionation.resolve_loop_flag = false; | 1849 | union_type->data.unionation.resolve_loop_flag = false; |
| 1832 | union_type->data.unionation.resolve_status = ResolveStatusSizeKnown; | 1850 | union_type->data.unionation.resolve_status = ResolveStatusSizeKnown; |
| 1833 | union_type->data.unionation.union_abi_size = union_abi_size; | 1851 | union_type->data.unionation.union_abi_size = union_abi_size; |
| 1834 | | 1852 | |
| 1835 | ZigType *tag_type = union_type->data.unionation.tag_type; | 1853 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 1836 | ZigType *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; | | |
| 1837 | if (tag_type != nullptr && type_has_bits(tag_type)) { | 1854 | if (tag_type != nullptr && type_has_bits(tag_type)) { |
| 1838 | if ((err = type_resolve(g, tag_type, ResolveStatusSizeKnown))) { | 1855 | if ((err = type_resolve(g, tag_type, ResolveStatusSizeKnown))) { |
| 1839 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; | 1856 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| ... | @@ -6340,16 +6357,25 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { | ... | @@ -6340,16 +6357,25 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { |
| 6340 | struct_type->llvm_type = type_has_bits(struct_type) ? | 6357 | struct_type->llvm_type = type_has_bits(struct_type) ? |
| 6341 | LLVMStructCreateNamed(LLVMGetGlobalContext(), buf_ptr(&struct_type->name)) : LLVMVoidType(); | 6358 | LLVMStructCreateNamed(LLVMGetGlobalContext(), buf_ptr(&struct_type->name)) : LLVMVoidType(); |
| 6342 | AstNode *decl_node = struct_type->data.structure.decl_node; | 6359 | AstNode *decl_node = struct_type->data.structure.decl_node; |
| 6343 | assert(decl_node->type == NodeTypeContainerDecl); | 6360 | ZigLLVMDIFile *di_file; |
| 6344 | Scope *scope = &struct_type->data.structure.decls_scope->base; | 6361 | ZigLLVMDIScope *di_scope; |
| 6345 | ZigType *import = get_scope_import(scope); | 6362 | unsigned line; |
| | 6363 | if (decl_node != nullptr) { |
| | 6364 | assert(decl_node->type == NodeTypeContainerDecl); |
| | 6365 | Scope *scope = &struct_type->data.structure.decls_scope->base; |
| | 6366 | ZigType *import = get_scope_import(scope); |
| | 6367 | di_file = import->data.structure.root_struct->di_file; |
| | 6368 | di_scope = ZigLLVMFileToScope(di_file); |
| | 6369 | line = decl_node->line + 1; |
| | 6370 | } else { |
| | 6371 | di_file = nullptr; |
| | 6372 | di_scope = ZigLLVMCompileUnitToScope(g->compile_unit); |
| | 6373 | line = 0; |
| | 6374 | } |
| 6346 | unsigned dwarf_kind = ZigLLVMTag_DW_structure_type(); | 6375 | unsigned dwarf_kind = ZigLLVMTag_DW_structure_type(); |
| 6347 | struct_type->llvm_di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, | 6376 | struct_type->llvm_di_type = ZigLLVMCreateReplaceableCompositeType(g->dbuilder, |
| 6348 | dwarf_kind, buf_ptr(&struct_type->name), | 6377 | dwarf_kind, buf_ptr(&struct_type->name), |
| 6349 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), | 6378 | di_scope, di_file, line); |
| 6350 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1)); | | |
| 6351 | | | |
| 6352 | | | |
| 6353 | | 6379 | |
| 6354 | size_t field_count = struct_type->data.structure.src_field_count; | 6380 | size_t field_count = struct_type->data.structure.src_field_count; |
| 6355 | size_t gen_field_count = struct_type->data.structure.gen_field_count; | 6381 | size_t gen_field_count = struct_type->data.structure.gen_field_count; |
| ... | @@ -6412,7 +6438,6 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { | ... | @@ -6412,7 +6438,6 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { |
| 6412 | ZigLLVMDIType **di_element_types = allocate<ZigLLVMDIType*>(debug_field_count); | 6438 | ZigLLVMDIType **di_element_types = allocate<ZigLLVMDIType*>(debug_field_count); |
| 6413 | size_t debug_field_index = 0; | 6439 | size_t debug_field_index = 0; |
| 6414 | for (size_t i = 0; i < field_count; i += 1) { | 6440 | for (size_t i = 0; i < field_count; i += 1) { |
| 6415 | AstNode *field_node = decl_node->data.container_decl.fields.at(i); | | |
| 6416 | TypeStructField *type_struct_field = &struct_type->data.structure.fields[i]; | 6441 | TypeStructField *type_struct_field = &struct_type->data.structure.fields[i]; |
| 6417 | size_t gen_field_index = type_struct_field->gen_index; | 6442 | size_t gen_field_index = type_struct_field->gen_index; |
| 6418 | if (gen_field_index == SIZE_MAX) { | 6443 | if (gen_field_index == SIZE_MAX) { |
| ... | @@ -6445,9 +6470,16 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { | ... | @@ -6445,9 +6470,16 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { |
| 6445 | debug_align_in_bits = 8 * field_type->abi_align; | 6470 | debug_align_in_bits = 8 * field_type->abi_align; |
| 6446 | debug_offset_in_bits = 8 * type_struct_field->offset; | 6471 | debug_offset_in_bits = 8 * type_struct_field->offset; |
| 6447 | } | 6472 | } |
| | 6473 | unsigned line; |
| | 6474 | if (decl_node != nullptr) { |
| | 6475 | AstNode *field_node = decl_node->data.container_decl.fields.at(i); |
| | 6476 | line = field_node->line + 1; |
| | 6477 | } else { |
| | 6478 | line = 0; |
| | 6479 | } |
| 6448 | di_element_types[debug_field_index] = ZigLLVMCreateDebugMemberType(g->dbuilder, | 6480 | di_element_types[debug_field_index] = ZigLLVMCreateDebugMemberType(g->dbuilder, |
| 6449 | ZigLLVMTypeToScope(struct_type->llvm_di_type), buf_ptr(type_struct_field->name), | 6481 | ZigLLVMTypeToScope(struct_type->llvm_di_type), buf_ptr(type_struct_field->name), |
| 6450 | import->data.structure.root_struct->di_file, (unsigned)(field_node->line + 1), | 6482 | di_file, line, |
| 6451 | debug_size_in_bits, | 6483 | debug_size_in_bits, |
| 6452 | debug_align_in_bits, | 6484 | debug_align_in_bits, |
| 6453 | debug_offset_in_bits, | 6485 | debug_offset_in_bits, |
| ... | @@ -6459,9 +6491,9 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { | ... | @@ -6459,9 +6491,9 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type) { |
| 6459 | uint64_t debug_size_in_bits = get_store_size_in_bits(struct_type->size_in_bits); | 6491 | uint64_t debug_size_in_bits = get_store_size_in_bits(struct_type->size_in_bits); |
| 6460 | uint64_t debug_align_in_bits = 8*struct_type->abi_align; | 6492 | uint64_t debug_align_in_bits = 8*struct_type->abi_align; |
| 6461 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | 6493 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| 6462 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), | 6494 | di_scope, |
| 6463 | buf_ptr(&struct_type->name), | 6495 | buf_ptr(&struct_type->name), |
| 6464 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), | 6496 | di_file, line, |
| 6465 | debug_size_in_bits, | 6497 | debug_size_in_bits, |
| 6466 | debug_align_in_bits, | 6498 | debug_align_in_bits, |
| 6467 | 0, nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); | 6499 | 0, nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); |
| ... | @@ -6512,19 +6544,14 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type) { | ... | @@ -6512,19 +6544,14 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type) { |
| 6512 | static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { | 6544 | static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { |
| 6513 | ZigType *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; | 6545 | ZigType *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 6514 | ZigType *tag_type = union_type->data.unionation.tag_type; | 6546 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| 6515 | if (tag_type == nullptr || !type_has_bits(tag_type)) { | | |
| 6516 | assert(most_aligned_union_member != nullptr); | | |
| 6517 | assert(union_type->data.unionation.union_abi_size >= most_aligned_union_member->abi_size); | | |
| 6518 | union_type->llvm_type = get_llvm_type(g, most_aligned_union_member); | | |
| 6519 | union_type->llvm_di_type = get_llvm_di_type(g, most_aligned_union_member); | | |
| 6520 | return; | | |
| 6521 | } | | |
| 6522 | if (most_aligned_union_member == nullptr) { | 6547 | if (most_aligned_union_member == nullptr) { |
| 6523 | union_type->llvm_type = get_llvm_type(g, tag_type); | 6548 | union_type->llvm_type = get_llvm_type(g, tag_type); |
| 6524 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); | 6549 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); |
| 6525 | return; | 6550 | return; |
| 6526 | } | 6551 | } |
| 6527 | | 6552 | |
| | 6553 | // Do this first for the benefit of recursive calls. |
| | 6554 | union_type->llvm_type = LLVMStructCreateNamed(LLVMGetGlobalContext(), buf_ptr(&union_type->name)); |
| 6528 | Scope *scope = &union_type->data.unionation.decls_scope->base; | 6555 | Scope *scope = &union_type->data.unionation.decls_scope->base; |
| 6529 | ZigType *import = get_scope_import(scope); | 6556 | ZigType *import = get_scope_import(scope); |
| 6530 | AstNode *decl_node = union_type->data.unionation.decl_node; | 6557 | AstNode *decl_node = union_type->data.unionation.decl_node; |
| ... | @@ -6535,6 +6562,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { | ... | @@ -6535,6 +6562,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { |
| 6535 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), | 6562 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), |
| 6536 | import->data.structure.root_struct->di_file, (unsigned)(line + 1)); | 6563 | import->data.structure.root_struct->di_file, (unsigned)(line + 1)); |
| 6537 | | 6564 | |
| | 6565 | |
| 6538 | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; | 6566 | uint32_t gen_field_count = union_type->data.unionation.gen_field_count; |
| 6539 | ZigLLVMDIType **union_inner_di_types = allocate<ZigLLVMDIType*>(gen_field_count); | 6567 | ZigLLVMDIType **union_inner_di_types = allocate<ZigLLVMDIType*>(gen_field_count); |
| 6540 | uint32_t field_count = union_type->data.unionation.src_field_count; | 6568 | uint32_t field_count = union_type->data.unionation.src_field_count; |
| ... | @@ -6555,7 +6583,40 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { | ... | @@ -6555,7 +6583,40 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type) { |
| 6555 | 0, get_llvm_di_type(g, union_field->type_entry)); | 6583 | 0, get_llvm_di_type(g, union_field->type_entry)); |
| 6556 | | 6584 | |
| 6557 | } | 6585 | } |
| 6558 | union_type->llvm_type = LLVMStructCreateNamed(LLVMGetGlobalContext(), buf_ptr(&union_type->name)); | 6586 | |
| | 6587 | if (tag_type == nullptr || !type_has_bits(tag_type)) { |
| | 6588 | assert(most_aligned_union_member != nullptr); |
| | 6589 | |
| | 6590 | size_t padding_bytes = union_type->data.unionation.union_abi_size - most_aligned_union_member->abi_size; |
| | 6591 | (void)get_llvm_type(g, most_aligned_union_member); |
| | 6592 | if (padding_bytes > 0) { |
| | 6593 | ZigType *u8_type = get_int_type(g, false, 8); |
| | 6594 | ZigType *padding_array = get_array_type(g, u8_type, padding_bytes); |
| | 6595 | LLVMTypeRef union_element_types[] = { |
| | 6596 | most_aligned_union_member->llvm_type, |
| | 6597 | get_llvm_type(g, padding_array), |
| | 6598 | }; |
| | 6599 | LLVMStructSetBody(union_type->llvm_type, union_element_types, 2, false); |
| | 6600 | } else { |
| | 6601 | LLVMStructSetBody(union_type->llvm_type, &most_aligned_union_member->llvm_type, 1, false); |
| | 6602 | } |
| | 6603 | union_type->data.unionation.union_llvm_type = union_type->llvm_type; |
| | 6604 | union_type->data.unionation.gen_tag_index = SIZE_MAX; |
| | 6605 | union_type->data.unionation.gen_union_index = SIZE_MAX; |
| | 6606 | |
| | 6607 | // create debug type for union |
| | 6608 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugUnionType(g->dbuilder, |
| | 6609 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), buf_ptr(&union_type->name), |
| | 6610 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| | 6611 | union_type->data.unionation.union_abi_size * 8, |
| | 6612 | most_aligned_union_member->abi_align * 8, |
| | 6613 | 0, union_inner_di_types, |
| | 6614 | gen_field_count, 0, ""); |
| | 6615 | |
| | 6616 | ZigLLVMReplaceTemporary(g->dbuilder, union_type->llvm_di_type, replacement_di_type); |
| | 6617 | union_type->llvm_di_type = replacement_di_type; |
| | 6618 | return; |
| | 6619 | } |
| 6559 | | 6620 | |
| 6560 | LLVMTypeRef union_type_ref; | 6621 | LLVMTypeRef union_type_ref; |
| 6561 | size_t padding_bytes = union_type->data.unionation.union_abi_size - most_aligned_union_member->abi_size; | 6622 | size_t padding_bytes = union_type->data.unionation.union_abi_size - most_aligned_union_member->abi_size; |
| ... | @@ -7018,8 +7079,8 @@ LLVMTypeRef get_llvm_type(CodeGen *g, ZigType *type) { | ... | @@ -7018,8 +7079,8 @@ LLVMTypeRef get_llvm_type(CodeGen *g, ZigType *type) { |
| 7018 | resolve_llvm_types(g, type); | 7079 | resolve_llvm_types(g, type); |
| 7019 | assert(type->llvm_type != nullptr); | 7080 | assert(type->llvm_type != nullptr); |
| 7020 | assert(type->llvm_di_type != nullptr); | 7081 | assert(type->llvm_di_type != nullptr); |
| 7021 | assert(type->abi_size == LLVMABISizeOfType(g->target_data_ref, type->llvm_type)); | 7082 | assert(type->abi_size == 0 || type->abi_size == LLVMABISizeOfType(g->target_data_ref, type->llvm_type)); |
| 7022 | assert(type->abi_align == LLVMABIAlignmentOfType(g->target_data_ref, type->llvm_type)); | 7083 | assert(type->abi_align == 0 || type->abi_align == LLVMABIAlignmentOfType(g->target_data_ref, type->llvm_type)); |
| 7023 | return type->llvm_type; | 7084 | return type->llvm_type; |
| 7024 | } | 7085 | } |
| 7025 | | 7086 | |
| ... | @@ -7029,7 +7090,7 @@ ZigLLVMDIType *get_llvm_di_type(CodeGen *g, ZigType *type) { | ... | @@ -7029,7 +7090,7 @@ ZigLLVMDIType *get_llvm_di_type(CodeGen *g, ZigType *type) { |
| 7029 | resolve_llvm_types(g, type); | 7090 | resolve_llvm_types(g, type); |
| 7030 | assert(type->llvm_type != nullptr); | 7091 | assert(type->llvm_type != nullptr); |
| 7031 | assert(type->llvm_di_type != nullptr); | 7092 | assert(type->llvm_di_type != nullptr); |
| 7032 | assert(type->abi_size == LLVMABISizeOfType(g->target_data_ref, type->llvm_type)); | 7093 | assert(type->abi_size == 0 || type->abi_size == LLVMABISizeOfType(g->target_data_ref, type->llvm_type)); |
| 7033 | assert(type->abi_align == LLVMABIAlignmentOfType(g->target_data_ref, type->llvm_type)); | 7094 | assert(type->abi_align == 0 || type->abi_align == LLVMABIAlignmentOfType(g->target_data_ref, type->llvm_type)); |
| 7034 | return type->llvm_di_type; | 7095 | return type->llvm_di_type; |
| 7035 | } | 7096 | } |