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`.
This commit is contained in:
@@ -4644,7 +4644,7 @@ pub const DeclGen = struct {
|
||||
const o = dg.object;
|
||||
const gpa = o.gpa;
|
||||
const mod = o.module;
|
||||
const src_loc = dg.decl.navSrcLoc(mod).upgrade(mod);
|
||||
const src_loc = dg.decl.navSrcLoc(mod);
|
||||
dg.err_msg = try Module.ErrorMsg.create(gpa, src_loc, "TODO (LLVM): " ++ format, args);
|
||||
return error.CodegenFail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user