| ... | ... | @@ -1349,6 +1349,18 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { |
| 1349 | 1349 | |
| 1350 | 1350 | TypeTableEntry *field_type = type_struct_field->type_entry; |
| 1351 | 1351 | |
| 1352 | // if the field is a function, actually the debug info should be a pointer. |
| 1353 | ZigLLVMDIType *field_di_type; |
| 1354 | if (field_type->id == TypeTableEntryIdFn) { |
| 1355 | TypeTableEntry *field_ptr_type = get_pointer_to_type(g, field_type, true); |
| 1356 | uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, field_ptr_type->type_ref); |
| 1357 | uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, field_ptr_type->type_ref); |
| 1358 | field_di_type = ZigLLVMCreateDebugPointerType(g->dbuilder, field_type->di_type, |
| 1359 | debug_size_in_bits, debug_align_in_bits, buf_ptr(&field_ptr_type->name)); |
| 1360 | } else { |
| 1361 | field_di_type = field_type->di_type; |
| 1362 | } |
| 1363 | |
| 1352 | 1364 | assert(field_type->type_ref); |
| 1353 | 1365 | assert(struct_type->type_ref); |
| 1354 | 1366 | assert(struct_type->data.structure.complete); |
| ... | ... | @@ -1362,7 +1374,7 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { |
| 1362 | 1374 | debug_size_in_bits, |
| 1363 | 1375 | debug_align_in_bits, |
| 1364 | 1376 | debug_offset_in_bits, |
| 1365 | | 0, field_type->di_type); |
| 1377 | 0, field_di_type); |
| 1366 | 1378 | |
| 1367 | 1379 | assert(di_element_types[gen_field_index]); |
| 1368 | 1380 | } |