aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-14 12:16:48 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-20 12:19:16 -0700
commit3c5927fb87034affd6af56ecd5d9ae07fe23d690 (patch)
treeda0d37df4e9379632b44ac2fc3145db5ee49cf1f /src/Compilation.zig
parentdbd3529d1fa02d5e720df0fbf2436d646f5a4f57 (diff)
downloadzig-3c5927fb87034affd6af56ecd5d9ae07fe23d690.tar.gz
zig-3c5927fb87034affd6af56ecd5d9ae07fe23d690.zip
Sema: add a strategy for handling costly source locations
Now you can pass `.unneeded` for a `LazySrcLoc` and if there ended up being a compile error that needed it, you'll get `error.NeededSourceLocation`. Callsites can now exploit this error to do the expensive computation to produce a source location object and then repeat the operation.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 4a442a8b67..f241ae6b10 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -148,7 +148,7 @@ emit_docs: ?EmitLoc,
work_queue_wait_group: WaitGroup,
astgen_wait_group: WaitGroup,
-pub const InnerError = Module.InnerError;
+pub const SemaError = Module.SemaError;
pub const CRTFile = struct {
lock: Cache.Lock,
@@ -3170,7 +3170,7 @@ pub fn addCCArgs(
try argv.appendSlice(comp.clang_argv);
}
-fn failCObj(comp: *Compilation, c_object: *CObject, comptime format: []const u8, args: anytype) InnerError {
+fn failCObj(comp: *Compilation, c_object: *CObject, comptime format: []const u8, args: anytype) SemaError {
@setCold(true);
const err_msg = blk: {
const msg = try std.fmt.allocPrint(comp.gpa, format, args);
@@ -3191,7 +3191,7 @@ fn failCObjWithOwnedErrorMsg(
comp: *Compilation,
c_object: *CObject,
err_msg: *CObject.ErrorMsg,
-) InnerError {
+) SemaError {
@setCold(true);
{
const lock = comp.mutex.acquire();