aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-30 14:28:04 +0200
committerVeikka Tuominen <git@vexu.eu>2022-12-30 17:00:50 +0200
commit4e64373fc07a1e24735bcbdfd463e11839c8c273 (patch)
treee59da20f467d336240c12cdc832834f22f361b30 /src/codegen/llvm.zig
parent4b5fc5239c37fa3f49965188256a781c7b1277a3 (diff)
downloadzig-4e64373fc07a1e24735bcbdfd463e11839c8c273.tar.gz
zig-4e64373fc07a1e24735bcbdfd463e11839c8c273.zip
fix generic function arg debug info referencing wrong parameter
Closes #14123
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 887e8d2bfc..fcf9423cd0 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -8062,7 +8062,7 @@ pub const FuncGen = struct {
return arg_val;
}
- const src_index = self.getSrcArgIndex(self.arg_index - 1);
+ const src_index = self.air.instructions.items(.data)[inst].arg.src_index;
const func = self.dg.decl.getFunction().?;
const lbrace_line = self.dg.module.declPtr(func.owner_decl).src_line + func.lbrace_line + 1;
const lbrace_col = func.lbrace_column + 1;
@@ -8095,16 +8095,6 @@ pub const FuncGen = struct {
return arg_val;
}
- fn getSrcArgIndex(self: *FuncGen, runtime_index: u32) u32 {
- const fn_info = self.dg.decl.ty.fnInfo();
- var i: u32 = 0;
- for (fn_info.param_types) |param_ty, src_index| {
- if (!param_ty.hasRuntimeBitsIgnoreComptime()) continue;
- if (i == runtime_index) return @intCast(u32, src_index);
- i += 1;
- } else unreachable;
- }
-
fn airAlloc(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
if (self.liveness.isUnused(inst)) return null;
const ptr_ty = self.air.typeOfIndex(inst);