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.
This commit is contained in:
Andrew Kelley 2021-07-27 15:10:49 -07:00
parent a8e964eadd
commit 1eeafc3967

View File

@ -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) {