From 1eeafc39675a349c912910da2a1b70097a934d57 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 27 Jul 2021 15:10:49 -0700 Subject: [PATCH] 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. --- src/Compilation.zig | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 00cdba85a4..8672a346c3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1737,6 +1737,13 @@ pub fn update(self: *Compilation) !void { if (!use_stage1) { if (self.bin_file.options.module) |module| { + if (self.bin_file.options.is_test and self.totalErrorCount() == 0) { + // The `test_functions` decl has been intentionally postponed until now, + // at which point we must populate it with the list of test functions that + // have been discovered and not filtered out. + try module.populateTestFunctions(); + } + // Process the deletion set. We use a while loop here because the // deletion set may grow as we call `clearDecl` within this loop, // and more unreferenced Decls are revealed. @@ -2384,14 +2391,6 @@ pub fn performAllTheWork(self: *Compilation) error{ TimerUnsupported, OutOfMemor }; }, }; - - if (self.bin_file.options.is_test and self.totalErrorCount() == 0) { - // The `test_functions` decl has been intentionally postponed until now, - // at which point we must populate it with the list of test functions that - // have been discovered and not filtered out. - const mod = self.bin_file.options.module.?; - try mod.populateTestFunctions(); - } } const AstGenSrc = union(enum) {