| ... | @@ -1331,7 +1331,7 @@ start_over: | ... | @@ -1331,7 +1331,7 @@ start_over: |
| 1331 | zig_unreachable(); | 1331 | zig_unreachable(); |
| 1332 | } | 1332 | } |
| 1333 | | 1333 | |
| 1334 | Error type_val_resolve_abi_align(CodeGen *g, ZigValue *type_val, uint32_t *abi_align) { | 1334 | Error type_val_resolve_abi_align(CodeGen *g, AstNode *source_node, ZigValue *type_val, uint32_t *abi_align) { |
| 1335 | Error err; | 1335 | Error err; |
| 1336 | if (type_val->special != ConstValSpecialLazy) { | 1336 | if (type_val->special != ConstValSpecialLazy) { |
| 1337 | assert(type_val->special == ConstValSpecialStatic); | 1337 | assert(type_val->special == ConstValSpecialStatic); |
| ... | @@ -1356,19 +1356,21 @@ Error type_val_resolve_abi_align(CodeGen *g, ZigValue *type_val, uint32_t *abi_a | ... | @@ -1356,19 +1356,21 @@ Error type_val_resolve_abi_align(CodeGen *g, ZigValue *type_val, uint32_t *abi_a |
| 1356 | *abi_align = g->builtin_types.entry_usize->abi_align; | 1356 | *abi_align = g->builtin_types.entry_usize->abi_align; |
| 1357 | return ErrorNone; | 1357 | return ErrorNone; |
| 1358 | case LazyValueIdOptType: { | 1358 | case LazyValueIdOptType: { |
| 1359 | LazyValueOptType *lazy_opt_type = reinterpret_cast<LazyValueOptType *>(type_val->data.x_lazy); | 1359 | if ((err = ir_resolve_lazy(g, nullptr, type_val))) |
| 1360 | return type_val_resolve_abi_align(g, lazy_opt_type->payload_type->value, abi_align); | 1360 | return err; |
| | 1361 | |
| | 1362 | return type_val_resolve_abi_align(g, source_node, type_val, abi_align); |
| 1361 | } | 1363 | } |
| 1362 | case LazyValueIdArrayType: { | 1364 | case LazyValueIdArrayType: { |
| 1363 | LazyValueArrayType *lazy_array_type = | 1365 | LazyValueArrayType *lazy_array_type = |
| 1364 | reinterpret_cast<LazyValueArrayType *>(type_val->data.x_lazy); | 1366 | reinterpret_cast<LazyValueArrayType *>(type_val->data.x_lazy); |
| 1365 | return type_val_resolve_abi_align(g, lazy_array_type->elem_type->value, abi_align); | 1367 | return type_val_resolve_abi_align(g, source_node, lazy_array_type->elem_type->value, abi_align); |
| 1366 | } | 1368 | } |
| 1367 | case LazyValueIdErrUnionType: { | 1369 | case LazyValueIdErrUnionType: { |
| 1368 | LazyValueErrUnionType *lazy_err_union_type = | 1370 | LazyValueErrUnionType *lazy_err_union_type = |
| 1369 | reinterpret_cast<LazyValueErrUnionType *>(type_val->data.x_lazy); | 1371 | reinterpret_cast<LazyValueErrUnionType *>(type_val->data.x_lazy); |
| 1370 | uint32_t payload_abi_align; | 1372 | uint32_t payload_abi_align; |
| 1371 | if ((err = type_val_resolve_abi_align(g, lazy_err_union_type->payload_type->value, | 1373 | if ((err = type_val_resolve_abi_align(g, source_node, lazy_err_union_type->payload_type->value, |
| 1372 | &payload_abi_align))) | 1374 | &payload_abi_align))) |
| 1373 | { | 1375 | { |
| 1374 | return err; | 1376 | return err; |
| ... | @@ -2335,7 +2337,7 @@ static Error resolve_union_alignment(CodeGen *g, ZigType *union_type) { | ... | @@ -2335,7 +2337,7 @@ static Error resolve_union_alignment(CodeGen *g, ZigType *union_type) { |
| 2335 | } | 2337 | } |
| 2336 | field->align = field->type_entry->abi_align; | 2338 | field->align = field->type_entry->abi_align; |
| 2337 | } else { | 2339 | } else { |
| 2338 | if ((err = type_val_resolve_abi_align(g, field->type_val, &field->align))) { | 2340 | if ((err = type_val_resolve_abi_align(g, field->decl_node, field->type_val, &field->align))) { |
| 2339 | if (g->trace_err != nullptr) { | 2341 | if (g->trace_err != nullptr) { |
| 2340 | g->trace_err = add_error_note(g, g->trace_err, field->decl_node, | 2342 | g->trace_err = add_error_note(g, g->trace_err, field->decl_node, |
| 2341 | buf_create_from_str("while checking this field")); | 2343 | buf_create_from_str("while checking this field")); |
| ... | @@ -2912,7 +2914,7 @@ static Error resolve_struct_alignment(CodeGen *g, ZigType *struct_type) { | ... | @@ -2912,7 +2914,7 @@ static Error resolve_struct_alignment(CodeGen *g, ZigType *struct_type) { |
| 2912 | } else if (packed) { | 2914 | } else if (packed) { |
| 2913 | field->align = 1; | 2915 | field->align = 1; |
| 2914 | } else { | 2916 | } else { |
| 2915 | if ((err = type_val_resolve_abi_align(g, field->type_val, &field->align))) { | 2917 | if ((err = type_val_resolve_abi_align(g, field->decl_node, field->type_val, &field->align))) { |
| 2916 | if (g->trace_err != nullptr) { | 2918 | if (g->trace_err != nullptr) { |
| 2917 | g->trace_err = add_error_note(g, g->trace_err, field->decl_node, | 2919 | g->trace_err = add_error_note(g, g->trace_err, field->decl_node, |
| 2918 | buf_create_from_str("while checking this field")); | 2920 | buf_create_from_str("while checking this field")); |