| ... | @@ -467,16 +467,49 @@ static TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *child_type, bo | ... | @@ -467,16 +467,49 @@ static TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *child_type, bo |
| 467 | | 467 | |
| 468 | slice_type_common_init(g, child_type, is_const, entry); | 468 | slice_type_common_init(g, child_type, is_const, entry); |
| 469 | | 469 | |
| 470 | LLVMZigDIType *di_element_types[] = { | 470 | |
| 471 | pointer_type->di_type, | | |
| 472 | g->builtin_types.entry_isize->di_type, | | |
| 473 | }; | | |
| 474 | LLVMZigDIScope *compile_unit_scope = LLVMZigCompileUnitToScope(g->compile_unit); | 471 | LLVMZigDIScope *compile_unit_scope = LLVMZigCompileUnitToScope(g->compile_unit); |
| | 472 | LLVMZigDIFile *di_file = nullptr; |
| | 473 | unsigned line = 0; |
| | 474 | entry->di_type = LLVMZigCreateReplaceableCompositeType(g->dbuilder, |
| | 475 | LLVMZigTag_DW_structure_type(), buf_ptr(&entry->name), |
| | 476 | compile_unit_scope, di_file, line); |
| | 477 | |
| | 478 | uint64_t ptr_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, pointer_type->type_ref); |
| | 479 | uint64_t ptr_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, pointer_type->type_ref); |
| | 480 | uint64_t ptr_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 0); |
| | 481 | |
| | 482 | TypeTableEntry *isize_type = g->builtin_types.entry_isize; |
| | 483 | uint64_t len_debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, isize_type->type_ref); |
| | 484 | uint64_t len_debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, isize_type->type_ref); |
| | 485 | uint64_t len_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, entry->type_ref, 1); |
| | 486 | |
| 475 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); | 487 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref); |
| 476 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); | 488 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, entry->type_ref); |
| 477 | entry->di_type = LLVMZigCreateDebugStructType(g->dbuilder, compile_unit_scope, | 489 | |
| 478 | buf_ptr(&entry->name), g->dummy_di_file, 0, debug_size_in_bits, debug_align_in_bits, 0, | 490 | LLVMZigDIType *di_element_types[] = { |
| 479 | nullptr, di_element_types, element_count, 0, nullptr, ""); | 491 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), |
| | 492 | "ptr", di_file, line, |
| | 493 | ptr_debug_size_in_bits, |
| | 494 | ptr_debug_align_in_bits, |
| | 495 | ptr_offset_in_bits, |
| | 496 | 0, child_type->di_type), |
| | 497 | LLVMZigCreateDebugMemberType(g->dbuilder, LLVMZigTypeToScope(entry->di_type), |
| | 498 | "len", di_file, line, |
| | 499 | len_debug_size_in_bits, |
| | 500 | len_debug_align_in_bits, |
| | 501 | len_offset_in_bits, |
| | 502 | 0, child_type->di_type), |
| | 503 | }; |
| | 504 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, |
| | 505 | compile_unit_scope, |
| | 506 | buf_ptr(&entry->name), |
| | 507 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, |
| | 508 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| | 509 | |
| | 510 | LLVMZigReplaceTemporary(g->dbuilder, entry->di_type, replacement_di_type); |
| | 511 | entry->di_type = replacement_di_type; |
| | 512 | |
| 480 | | 513 | |
| 481 | entry->data.structure.complete = true; | 514 | entry->data.structure.complete = true; |
| 482 | | 515 | |