@@ -489,20 +489,27 @@ ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_cons
489
489
entry->zero_bits = !type_has_bits (child_type);
490
490
491
491
if (!entry->zero_bits ) {
492
- if (is_const || is_volatile || host_int_bytes != 0 || byte_alignment != 0 ||
493
- ptr_len != PtrLenSingle)
494
- {
495
- ZigType *peer_type = get_pointer_to_type (g, child_type, false );
492
+ if (is_const || is_volatile || byte_alignment != 0 || ptr_len != PtrLenSingle || bit_offset_in_host != 0 ) {
493
+ ZigType *peer_type = get_pointer_to_type_extra (g, child_type, false , false ,
494
+ PtrLenSingle, 0 , 0 , host_int_bytes);
496
495
entry->type_ref = peer_type->type_ref ;
497
496
entry->di_type = peer_type->di_type ;
498
497
} else {
499
- entry->type_ref = LLVMPointerType (child_type->type_ref , 0 );
500
-
501
- uint64_t debug_size_in_bits = 8 *LLVMStoreSizeOfType (g->target_data_ref , entry->type_ref );
502
- uint64_t debug_align_in_bits = 8 *LLVMABIAlignmentOfType (g->target_data_ref , entry->type_ref );
503
- assert (child_type->di_type );
504
- entry->di_type = ZigLLVMCreateDebugPointerType (g->dbuilder , child_type->di_type ,
505
- debug_size_in_bits, debug_align_in_bits, buf_ptr (&entry->name ));
498
+ if (host_int_bytes == 0 ) {
499
+ entry->type_ref = LLVMPointerType (child_type->type_ref , 0 );
500
+ uint64_t debug_size_in_bits = 8 *LLVMStoreSizeOfType (g->target_data_ref , entry->type_ref );
501
+ uint64_t debug_align_in_bits = 8 *LLVMABIAlignmentOfType (g->target_data_ref , entry->type_ref );
502
+ assert (child_type->di_type );
503
+ entry->di_type = ZigLLVMCreateDebugPointerType (g->dbuilder , child_type->di_type ,
504
+ debug_size_in_bits, debug_align_in_bits, buf_ptr (&entry->name ));
505
+ } else {
506
+ ZigType *host_int_type = get_int_type (g, false , host_int_bytes * 8 );
507
+ entry->type_ref = LLVMPointerType (host_int_type->type_ref , 0 );
508
+ uint64_t debug_size_in_bits = 8 *LLVMStoreSizeOfType (g->target_data_ref , host_int_type->type_ref );
509
+ uint64_t debug_align_in_bits = 8 *LLVMABIAlignmentOfType (g->target_data_ref , host_int_type->type_ref );
510
+ entry->di_type = ZigLLVMCreateDebugPointerType (g->dbuilder , host_int_type->di_type ,
511
+ debug_size_in_bits, debug_align_in_bits, buf_ptr (&entry->name ));
512
+ }
506
513
}
507
514
} else {
508
515
assert (byte_alignment == 0 );
0 commit comments