| ... | @@ -4481,11 +4481,18 @@ fn findTrackableInner( | ... | @@ -4481,11 +4481,18 @@ fn findTrackableInner( |
| 4481 | .func, | 4481 | .func, |
| 4482 | .func_inferred, | 4482 | .func_inferred, |
| 4483 | => { | 4483 | => { |
| | 4484 | const inst_data = datas[@intFromEnum(inst)].pl_node; |
| | 4485 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| | 4486 | |
| | 4487 | if (extra.data.body_len == 0) { |
| | 4488 | // This is just a prototype. No need to track. |
| | 4489 | assert(extra.data.ret_body_len < 2); |
| | 4490 | return; |
| | 4491 | } |
| | 4492 | |
| 4484 | assert(contents.func_decl == null); | 4493 | assert(contents.func_decl == null); |
| 4485 | contents.func_decl = inst; | 4494 | contents.func_decl = inst; |
| 4486 | | 4495 | |
| 4487 | const inst_data = datas[@intFromEnum(inst)].pl_node; | | |
| 4488 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); | | |
| 4489 | var extra_index: usize = extra.end; | 4496 | var extra_index: usize = extra.end; |
| 4490 | switch (extra.data.ret_body_len) { | 4497 | switch (extra.data.ret_body_len) { |
| 4491 | 0 => {}, | 4498 | 0 => {}, |
| ... | @@ -4500,11 +4507,19 @@ fn findTrackableInner( | ... | @@ -4500,11 +4507,19 @@ fn findTrackableInner( |
| 4500 | return zir.findTrackableBody(gpa, contents, defers, body); | 4507 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4501 | }, | 4508 | }, |
| 4502 | .func_fancy => { | 4509 | .func_fancy => { |
| | 4510 | const inst_data = datas[@intFromEnum(inst)].pl_node; |
| | 4511 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| | 4512 | |
| | 4513 | if (extra.data.body_len == 0) { |
| | 4514 | // This is just a prototype. No need to track. |
| | 4515 | assert(!extra.data.bits.has_cc_body); |
| | 4516 | assert(!extra.data.bits.has_ret_ty_body); |
| | 4517 | return; |
| | 4518 | } |
| | 4519 | |
| 4503 | assert(contents.func_decl == null); | 4520 | assert(contents.func_decl == null); |
| 4504 | contents.func_decl = inst; | 4521 | contents.func_decl = inst; |
| 4505 | | 4522 | |
| 4506 | const inst_data = datas[@intFromEnum(inst)].pl_node; | | |
| 4507 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); | | |
| 4508 | var extra_index: usize = extra.end; | 4523 | var extra_index: usize = extra.end; |
| 4509 | | 4524 | |
| 4510 | if (extra.data.bits.has_cc_body) { | 4525 | if (extra.data.bits.has_cc_body) { |
| ... | @@ -5026,10 +5041,16 @@ pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { | ... | @@ -5026,10 +5041,16 @@ pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { |
| 5026 | .struct_init_ref, | 5041 | .struct_init_ref, |
| 5027 | .struct_init_anon, | 5042 | .struct_init_anon, |
| 5028 | => {}, // tracked in order, as the owner instructions of anonymous struct types | 5043 | => {}, // tracked in order, as the owner instructions of anonymous struct types |
| 5029 | .func, | 5044 | .func, .func_inferred => { |
| 5030 | .func_inferred, | 5045 | // These are tracked provided they are actual function declarations, not just bodies. |
| 5031 | .func_fancy, | 5046 | const extra = zir.extraData(Inst.Func, inst.data.pl_node.payload_index); |
| 5032 | => {}, // tracked in order, as the owner instructions of function bodies | 5047 | assert(extra.data.body_len != 0); |
| | 5048 | }, |
| | 5049 | .func_fancy => { |
| | 5050 | // These are tracked provided they are actual function declarations, not just bodies. |
| | 5051 | const extra = zir.extraData(Inst.FuncFancy, inst.data.pl_node.payload_index); |
| | 5052 | assert(extra.data.body_len != 0); |
| | 5053 | }, |
| 5033 | .declaration => {}, // tracked by correlating names in the namespace of the parent container | 5054 | .declaration => {}, // tracked by correlating names in the namespace of the parent container |
| 5034 | .extended => switch (inst.data.extended.opcode) { | 5055 | .extended => switch (inst.data.extended.opcode) { |
| 5035 | .struct_decl, | 5056 | .struct_decl, |