authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-27 15:10:49-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-27 15:10:49-07:00
log1eeafc39675a349c912910da2a1b70097a934d57
treea7fdbc64cd051046d86d3614d90f62ea3eef5af8
parenta8e964eadd3496330043985cacaaee7db92886c6

stage2: move call to populateTestFunctions() outside performAllTheWork()

Before calling populateTestFunctions() we want to check totalErrorCount() but that will read from some tables that might get populated by the thread pool for C compilation tasks. So we wait until all those tasks are finished before proceeding.

1 files changed, 7 insertions(+), 8 deletions(-)

src/Compilation.zig+7-8
......@@ -1737,6 +1737,13 @@ pub fn update(self: *Compilation) !void {
17371737
17381738 if (!use_stage1) {
17391739 if (self.bin_file.options.module) |module| {
1740 if (self.bin_file.options.is_test and self.totalErrorCount() == 0) {
1741 // The `test_functions` decl has been intentionally postponed until now,
1742 // at which point we must populate it with the list of test functions that
1743 // have been discovered and not filtered out.
1744 try module.populateTestFunctions();
1745 }
1746
17401747 // Process the deletion set. We use a while loop here because the
17411748 // deletion set may grow as we call `clearDecl` within this loop,
17421749 // and more unreferenced Decls are revealed.
......@@ -2384,14 +2391,6 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor
23842391 };
23852392 },
23862393 };
2387
2388 if (self.bin_file.options.is_test and self.totalErrorCount() == 0) {
2389 // The `test_functions` decl has been intentionally postponed until now,
2390 // at which point we must populate it with the list of test functions that
2391 // have been discovered and not filtered out.
2392 const mod = self.bin_file.options.module.?;
2393 try mod.populateTestFunctions();
2394 }
23952394}
23962395
23972396const AstGenSrc = union(enum) {