| ... | ... | @@ -3341,6 +3341,9 @@ fn ptrType( |
| 3341 | 3341 | return gz.astgen.failTok(ptr_info.allowzero_token.?, "C pointers always allow address zero", .{}); |
| 3342 | 3342 | } |
| 3343 | 3343 | |
| 3344 | const source_offset = gz.astgen.source_offset; |
| 3345 | const source_line = gz.astgen.source_line; |
| 3346 | const source_column = gz.astgen.source_column; |
| 3344 | 3347 | const elem_type = try typeExpr(gz, scope, ptr_info.ast.child_type); |
| 3345 | 3348 | |
| 3346 | 3349 | var sentinel_ref: Zir.Inst.Ref = .none; |
| ... | ... | @@ -3351,17 +3354,31 @@ fn ptrType( |
| 3351 | 3354 | var trailing_count: u32 = 0; |
| 3352 | 3355 | |
| 3353 | 3356 | if (ptr_info.ast.sentinel != 0) { |
| 3357 | // These attributes can appear in any order and they all come before the |
| 3358 | // element type so we need to reset the source cursor before generating them. |
| 3359 | gz.astgen.source_offset = source_offset; |
| 3360 | gz.astgen.source_line = source_line; |
| 3361 | gz.astgen.source_column = source_column; |
| 3362 | |
| 3354 | 3363 | sentinel_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .ty = elem_type } }, ptr_info.ast.sentinel); |
| 3355 | 3364 | trailing_count += 1; |
| 3356 | 3365 | } |
| 3357 | | if (ptr_info.ast.align_node != 0) { |
| 3358 | | align_ref = try expr(gz, scope, coerced_align_ri, ptr_info.ast.align_node); |
| 3359 | | trailing_count += 1; |
| 3360 | | } |
| 3361 | 3366 | if (ptr_info.ast.addrspace_node != 0) { |
| 3367 | gz.astgen.source_offset = source_offset; |
| 3368 | gz.astgen.source_line = source_line; |
| 3369 | gz.astgen.source_column = source_column; |
| 3370 | |
| 3362 | 3371 | addrspace_ref = try expr(gz, scope, .{ .rl = .{ .ty = .address_space_type } }, ptr_info.ast.addrspace_node); |
| 3363 | 3372 | trailing_count += 1; |
| 3364 | 3373 | } |
| 3374 | if (ptr_info.ast.align_node != 0) { |
| 3375 | gz.astgen.source_offset = source_offset; |
| 3376 | gz.astgen.source_line = source_line; |
| 3377 | gz.astgen.source_column = source_column; |
| 3378 | |
| 3379 | align_ref = try expr(gz, scope, coerced_align_ri, ptr_info.ast.align_node); |
| 3380 | trailing_count += 1; |
| 3381 | } |
| 3365 | 3382 | if (ptr_info.ast.bit_range_start != 0) { |
| 3366 | 3383 | assert(ptr_info.ast.bit_range_end != 0); |
| 3367 | 3384 | bit_start_ref = try expr(gz, scope, .{ .rl = .{ .coerced_ty = .u16_type } }, ptr_info.ast.bit_range_start); |