aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-04-23 09:38:38 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-05-16 17:42:51 -0700
commit53a5aee3b3684a03c91236702c9304dce21279e2 (patch)
treeb14c0c4d2f017d9423f5f050aa42ea66eaa4ae7a /src/codegen/llvm.zig
parent66c3988e5eebd423844d5dd20c762d6fefe20adf (diff)
downloadzig-53a5aee3b3684a03c91236702c9304dce21279e2.tar.gz
zig-53a5aee3b3684a03c91236702c9304dce21279e2.zip
stage2: enable error return tracing on llvm backend
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index f6bb989f37..9998f1d40f 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -637,7 +637,7 @@ pub const Object = struct {
const gpa = dg.gpa;
const err_return_tracing = fn_info.return_type.isError() and
- dg.module.comp.bin_file.options.error_return_tracing and false;
+ dg.module.comp.bin_file.options.error_return_tracing;
const err_ret_trace = if (err_return_tracing)
llvm_func.getParam(@boolToInt(ret_ptr != null))
@@ -698,6 +698,9 @@ pub const Object = struct {
const lexical_block = dib.createLexicalBlock(subprogram.toScope(), di_file.?, line_number, 1);
di_scope = lexical_block.toScope();
+
+ // Setup a debug location in case there is a call to `returnError` before a `.dbg_stmt`.
+ builder.setCurrentDebugLocation(line_number + func.lbrace_line, func.lbrace_column, di_scope.?, null);
}
var fg: FuncGen = .{
@@ -1765,7 +1768,7 @@ pub const Object = struct {
}
if (fn_info.return_type.isError() and
- o.module.comp.bin_file.options.error_return_tracing and false)
+ o.module.comp.bin_file.options.error_return_tracing)
{
var ptr_ty_payload: Type.Payload.ElemType = .{
.base = .{ .tag = .single_mut_pointer },
@@ -2018,7 +2021,7 @@ pub const DeclGen = struct {
}
const err_return_tracing = fn_info.return_type.isError() and
- dg.module.comp.bin_file.options.error_return_tracing and false;
+ dg.module.comp.bin_file.options.error_return_tracing;
if (err_return_tracing) {
dg.addArgAttr(llvm_fn, @boolToInt(sret), "nonnull");
@@ -2484,7 +2487,7 @@ pub const DeclGen = struct {
}
if (fn_info.return_type.isError() and
- dg.module.comp.bin_file.options.error_return_tracing and false)
+ dg.module.comp.bin_file.options.error_return_tracing)
{
var ptr_ty_payload: Type.Payload.ElemType = .{
.base = .{ .tag = .single_mut_pointer },
@@ -3796,7 +3799,7 @@ pub const FuncGen = struct {
};
if (fn_info.return_type.isError() and
- self.dg.module.comp.bin_file.options.error_return_tracing and false)
+ self.dg.module.comp.bin_file.options.error_return_tracing)
{
try llvm_args.append(self.err_ret_trace.?);
}