authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-26 12:20:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 20:56:48-07:00
logd3b03ed64b9c3a4a963e6e5bef536c61c0e3e3c0
treea5eb66eba5de8df135c549938a9c913583714811
parenteb718ceffa0fd656a169a1dd2794e6e99bf5bcaa

frontend: fix use of undefined progress node

This was causing a crash when running `zig test`.

1 files changed, 10 insertions(+), 4 deletions(-)

src/Module.zig+10-4
...@@ -5340,15 +5340,13 @@ pub fn populateTestFunctions(...@@ -5340,15 +5340,13 @@ pub fn populateTestFunctions(
5340 // We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions`5340 // We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions`
5341 // was not referenced by start code.5341 // was not referenced by start code.
5342 mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0);5342 mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0);
5343 mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
5344 defer {5343 defer {
5345 mod.sema_prog_node.end();5344 mod.sema_prog_node.end();
5346 mod.sema_prog_node = undefined;5345 mod.sema_prog_node = undefined;
5347 mod.codegen_prog_node.end();
5348 mod.codegen_prog_node = undefined;
5349 }5346 }
5350 try mod.ensureDeclAnalyzed(decl_index);5347 try mod.ensureDeclAnalyzed(decl_index);
5351 }5348 }
5349
5352 const decl = mod.declPtr(decl_index);5350 const decl = mod.declPtr(decl_index);
5353 const test_fn_ty = decl.typeOf(mod).slicePtrFieldType(mod).childType(mod);5351 const test_fn_ty = decl.typeOf(mod).slicePtrFieldType(mod).childType(mod);
53545352
...@@ -5449,7 +5447,15 @@ pub fn populateTestFunctions(...@@ -5449,7 +5447,15 @@ pub fn populateTestFunctions(
5449 decl.val = new_val;5447 decl.val = new_val;
5450 decl.has_tv = true;5448 decl.has_tv = true;
5451 }5449 }
5452 try mod.linkerUpdateDecl(decl_index);5450 {
5451 mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
5452 defer {
5453 mod.codegen_prog_node.end();
5454 mod.codegen_prog_node = undefined;
5455 }
5456
5457 try mod.linkerUpdateDecl(decl_index);
5458 }
5453}5459}
54545460
5455pub fn linkerUpdateDecl(zcu: *Zcu, decl_index: Decl.Index) !void {5461pub fn linkerUpdateDecl(zcu: *Zcu, decl_index: Decl.Index) !void {