cl: fix dbg.declare (and local var)

This commit is contained in:
Li Jie
2024-09-18 23:45:27 +08:00
parent 3b514d194c
commit b0f04d91bf

View File

@@ -730,16 +730,12 @@ func (p *context) compileInstr(b llssa.Builder, instr ssa.Instruction) {
// Not a local variable.
return
}
if v.IsAddr {
// *ssa.Alloc or *ssa.FieldAddr
return
}
pos := p.goProg.Fset.Position(v.Pos())
value := p.compileValue(b, v.X)
fn := v.Parent()
dbgVar := p.getLocalVariable(b, fn, variable)
if v.IsAddr {
// *ssa.Alloc or *ssa.FieldAddr
b.DIDeclare(value, dbgVar, p.fn, pos, b.Func.Block(v.Block().Index))
} else {
b.DIValue(value, dbgVar, p.fn, pos, b.Func.Block(v.Block().Index))