From ded5c759f83a4da355a128dd4d7f5e22cbd3cabe Mon Sep 17 00:00:00 2001 From: mlugg Date: Sun, 30 Jun 2024 03:00:07 +0100 Subject: Zcu: store `LazySrcLoc` in error messages This change modifies `Zcu.ErrorMsg` to store a `Zcu.LazySrcLoc` rather than a `Zcu.SrcLoc`. Everything else is dominoes. The reason for this change is incremental compilation. If a failed `AnalUnit` is up-to-date on an update, we want to re-use the old error messages. However, the file containing the error location may have been modified, and `SrcLoc` cannot survive such a modification. `LazySrcLoc` is designed to be correct across incremental updates. Therefore, we defer source location resolution until `Compilation` gathers the compile errors into the `ErrorBundle`. --- src/arch/x86_64/CodeGen.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/arch/x86_64/CodeGen.zig') diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index ea6f0f8a4e..31ed0bf514 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -74,7 +74,7 @@ va_info: union { ret_mcv: InstTracking, fn_type: Type, arg_index: u32, -src_loc: Module.SrcLoc, +src_loc: Module.LazySrcLoc, eflags_inst: ?Air.Inst.Index = null, @@ -795,7 +795,7 @@ const Self = @This(); pub fn generate( bin_file: *link.File, - src_loc: Module.SrcLoc, + src_loc: Module.LazySrcLoc, func_index: InternPool.Index, air: Air, liveness: Liveness, @@ -971,7 +971,7 @@ pub fn generate( pub fn generateLazy( bin_file: *link.File, - src_loc: Module.SrcLoc, + src_loc: Module.LazySrcLoc, lazy_sym: link.File.LazySymbol, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -- cgit v1.2.3