| ... | ... | @@ -429,6 +429,9 @@ static void resolve_struct_type(CodeGen *g, ImportTableEntry *import, TypeTableE |
| 429 | 429 | |
| 430 | 430 | if (type_struct_field->type_entry->id == TypeTableEntryIdStruct) { |
| 431 | 431 | resolve_struct_type(g, import, type_struct_field->type_entry); |
| 432 | } else if (type_struct_field->type_entry->id == TypeTableEntryIdInvalid) { |
| 433 | struct_type->data.structure.is_invalid = true; |
| 434 | continue; |
| 432 | 435 | } |
| 433 | 436 | |
| 434 | 437 | di_element_types[i] = LLVMZigCreateDebugMemberType(g->dbuilder, |
| ... | ... | @@ -451,19 +454,22 @@ static void resolve_struct_type(CodeGen *g, ImportTableEntry *import, TypeTableE |
| 451 | 454 | } |
| 452 | 455 | struct_type->data.structure.embedded_in_current = false; |
| 453 | 456 | |
| 454 | | LLVMStructSetBody(struct_type->type_ref, element_types, field_count, false); |
| 457 | if (!struct_type->data.structure.is_invalid) { |
| 458 | |
| 459 | LLVMStructSetBody(struct_type->type_ref, element_types, field_count, false); |
| 455 | 460 | |
| 456 | | struct_type->align_in_bits = first_field_align_in_bits; |
| 457 | | struct_type->size_in_bits = total_size_in_bits; |
| 461 | struct_type->align_in_bits = first_field_align_in_bits; |
| 462 | struct_type->size_in_bits = total_size_in_bits; |
| 458 | 463 | |
| 459 | | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, |
| 460 | | LLVMZigFileToScope(import->di_file), |
| 461 | | buf_ptr(&decl_node->data.struct_decl.name), |
| 462 | | import->di_file, decl_node->line + 1, struct_type->size_in_bits, struct_type->align_in_bits, 0, |
| 463 | | nullptr, di_element_types, field_count, 0, nullptr, ""); |
| 464 | LLVMZigDIType *replacement_di_type = LLVMZigCreateDebugStructType(g->dbuilder, |
| 465 | LLVMZigFileToScope(import->di_file), |
| 466 | buf_ptr(&decl_node->data.struct_decl.name), |
| 467 | import->di_file, decl_node->line + 1, struct_type->size_in_bits, struct_type->align_in_bits, 0, |
| 468 | nullptr, di_element_types, field_count, 0, nullptr, ""); |
| 464 | 469 | |
| 465 | | LLVMZigReplaceTemporary(g->dbuilder, struct_type->di_type, replacement_di_type); |
| 466 | | struct_type->di_type = replacement_di_type; |
| 470 | LLVMZigReplaceTemporary(g->dbuilder, struct_type->di_type, replacement_di_type); |
| 471 | struct_type->di_type = replacement_di_type; |
| 472 | } |
| 467 | 473 | } |
| 468 | 474 | |
| 469 | 475 | static void preview_fn_def(CodeGen *g, ImportTableEntry *import, AstNode *node, TypeTableEntry *struct_type) { |