@@ -16470,12 +16470,12 @@ static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstruc
16470
16470
if (type_is_invalid(src_type))
16471
16471
return ira->codegen->builtin_types.entry_invalid;
16472
16472
16473
- if (!type_is_codegen_pointer (src_type)) {
16473
+ if (get_codegen_ptr_type (src_type) == nullptr ) {
16474
16474
ir_add_error(ira, ptr, buf_sprintf("expected pointer, found '%s'", buf_ptr(&src_type->name)));
16475
16475
return ira->codegen->builtin_types.entry_invalid;
16476
16476
}
16477
16477
16478
- if (!type_is_codegen_pointer (dest_type)) {
16478
+ if (get_codegen_ptr_type (dest_type) == nullptr ) {
16479
16479
ir_add_error(ira, dest_type_value,
16480
16480
buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
16481
16481
return ira->codegen->builtin_types.entry_invalid;
@@ -16662,9 +16662,9 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
16662
16662
ensure_complete_type(ira->codegen, dest_type);
16663
16663
ensure_complete_type(ira->codegen, src_type);
16664
16664
16665
- if (type_is_codegen_pointer (src_type)) {
16665
+ if (get_codegen_ptr_type (src_type) != nullptr ) {
16666
16666
ir_add_error(ira, value,
16667
- buf_sprintf("unable to @bitCast from type '%s'", buf_ptr(&src_type->name)));
16667
+ buf_sprintf("unable to @bitCast from pointer type '%s'", buf_ptr(&src_type->name)));
16668
16668
return ira->codegen->builtin_types.entry_invalid;
16669
16669
}
16670
16670
@@ -16689,9 +16689,9 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc
16689
16689
break;
16690
16690
}
16691
16691
16692
- if (type_is_codegen_pointer (dest_type)) {
16692
+ if (get_codegen_ptr_type (dest_type) != nullptr ) {
16693
16693
ir_add_error(ira, dest_type_value,
16694
- buf_sprintf("unable to @bitCast to type '%s'", buf_ptr(&dest_type->name)));
16694
+ buf_sprintf("unable to @bitCast to pointer type '%s'", buf_ptr(&dest_type->name)));
16695
16695
return ira->codegen->builtin_types.entry_invalid;
16696
16696
}
16697
16697
@@ -16752,7 +16752,7 @@ static TypeTableEntry *ir_analyze_instruction_int_to_ptr(IrAnalyze *ira, IrInstr
16752
16752
if (type_is_invalid(dest_type))
16753
16753
return ira->codegen->builtin_types.entry_invalid;
16754
16754
16755
- if (!type_is_codegen_pointer (dest_type)) {
16755
+ if (get_codegen_ptr_type (dest_type) == nullptr ) {
16756
16756
ir_add_error(ira, dest_type_value, buf_sprintf("expected pointer, found '%s'", buf_ptr(&dest_type->name)));
16757
16757
return ira->codegen->builtin_types.entry_invalid;
16758
16758
}
@@ -16858,9 +16858,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstr
16858
16858
16859
16859
TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
16860
16860
16861
- if (!(type_is_codegen_pointer(target->value.type) || (target->value.type->id == TypeTableEntryIdMaybe &&
16862
- type_is_codegen_pointer(target->value.type->data.maybe.child_type))))
16863
- {
16861
+ if (get_codegen_ptr_type(target->value.type) == nullptr) {
16864
16862
ir_add_error(ira, target,
16865
16863
buf_sprintf("expected pointer, found '%s'", buf_ptr(&target->value.type->name)));
16866
16864
return ira->codegen->builtin_types.entry_invalid;
0 commit comments