mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 14:55:25 +00:00
LLVM: fix debug info for local vars
Previously we incorrectly used the pointer type as the debug info type.
This commit is contained in:
parent
cb3b1dd6dd
commit
eeaaefb925
10
src/Sema.zig
10
src/Sema.zig
@ -4195,7 +4195,15 @@ fn zirDbgVar(
|
||||
const str_op = sema.code.instructions.items(.data)[inst].str_op;
|
||||
const operand = sema.resolveInst(str_op.operand);
|
||||
const operand_ty = sema.typeOf(operand);
|
||||
if (!(try sema.typeHasRuntimeBits(block, sema.src, operand_ty))) return;
|
||||
switch (air_tag) {
|
||||
.dbg_var_ptr => {
|
||||
if (!(try sema.typeHasRuntimeBits(block, sema.src, operand_ty.childType()))) return;
|
||||
},
|
||||
.dbg_var_val => {
|
||||
if (!(try sema.typeHasRuntimeBits(block, sema.src, operand_ty))) return;
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
const name = str_op.getStr(sema.code);
|
||||
|
||||
// Add the name to the AIR.
|
||||
|
||||
@ -3984,13 +3984,14 @@ pub const FuncGen = struct {
|
||||
const pl_op = self.air.instructions.items(.data)[inst].pl_op;
|
||||
const operand = try self.resolveInst(pl_op.operand);
|
||||
const name = self.air.nullTerminatedString(pl_op.payload);
|
||||
const ptr_ty = self.air.typeOf(pl_op.operand);
|
||||
|
||||
const di_local_var = dib.createAutoVariable(
|
||||
self.di_scope.?,
|
||||
name.ptr,
|
||||
self.di_file.?,
|
||||
self.prev_dbg_line,
|
||||
try self.dg.lowerDebugType(self.air.typeOf(pl_op.operand)),
|
||||
try self.dg.lowerDebugType(ptr_ty.childType()),
|
||||
true, // always preserve
|
||||
0, // flags
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user