diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-10-16 15:59:27 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-10-16 16:30:36 +0100 |
| commit | c6842b58d488c236aca74dea82082eec365eb117 (patch) | |
| tree | c858fc6af4e0a3358c22e5b0f4411e54e003cb8b /src/Sema.zig | |
| parent | a7dd34bfc57f4f84bb5290177f26e2d1f0bdc27e (diff) | |
| download | zig-c6842b58d488c236aca74dea82082eec365eb117.tar.gz zig-c6842b58d488c236aca74dea82082eec365eb117.zip | |
Zcu: cache output of `resolveReferences` between calls
This not only simplifies the error bundling logic, but also improves
efficiency by allowing the result to be cached between, for instance,
multiple calls to `totalErrorCount`.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 1250a06a9c..d4a6d03878 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2559,10 +2559,9 @@ pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Zcu.ErrorMsg const zcu = sema.pt.zcu; if (build_options.enable_debug_extensions and zcu.comp.debug_compile_errors) { - var all_references: ?std.AutoHashMapUnmanaged(AnalUnit, ?Zcu.ResolvedReference) = null; var wip_errors: std.zig.ErrorBundle.Wip = undefined; wip_errors.init(gpa) catch @panic("out of memory"); - Compilation.addModuleErrorMsg(zcu, &wip_errors, err_msg.*, &all_references) catch @panic("out of memory"); + Compilation.addModuleErrorMsg(zcu, &wip_errors, err_msg.*) catch @panic("out of memory"); std.debug.print("compile error during Sema:\n", .{}); var error_bundle = wip_errors.toOwnedBundle("") catch @panic("out of memory"); error_bundle.renderToStdErr(.{ .ttyconf = .no_color }); |
