This commit is contained in:
Li Jie
2024-09-15 15:14:56 +08:00
parent 24995f46cb
commit 9978a370f1
2 changed files with 10 additions and 9 deletions

View File

@@ -306,6 +306,7 @@ func (p *context) debugParams(b llssa.Builder, f *ssa.Function) {
argNo := i + 1
div := b.DIVarParam(p.fn, pos, param.Name(), b.Prog.Type(ty, llssa.InGo), argNo)
b.DIDeclare(v, div, p.fn, pos, p.fn.Block(0))
b.DIValue(v, div, p.fn, pos, p.fn.Block(0))
}
}

View File

@@ -13,7 +13,7 @@ import (
type aDIBuilder struct {
di *llvm.DIBuilder
prog Program
diTypes map[Type]DIType
types map[Type]DIType
}
type diBuilder = *aDIBuilder
@@ -38,7 +38,7 @@ func newDIBuilder(prog Program, pkg Package) diBuilder {
return &aDIBuilder{
di: llvm.NewDIBuilder(m),
prog: prog,
diTypes: make(map[*aType]DIType),
types: make(map[*aType]DIType),
}
}
@@ -280,7 +280,7 @@ func (b diBuilder) createStructType(ty Type, pos token.Position) (ret DIType) {
Name: ty.RawType().String(),
},
)}
b.diTypes[ty] = ret
b.types[ty] = ret
// Create struct type
structType := ty.RawType().(*types.Struct)
@@ -379,11 +379,11 @@ func (b diBuilder) dbgValue(v Expr, dv DIVar, scope DIScope, pos token.Position,
}
func (b diBuilder) diType(t Type, pos token.Position) DIType {
if ty, ok := b.diTypes[t]; ok {
if ty, ok := b.types[t]; ok {
return ty
}
ty := b.createType(t, pos)
b.diTypes[t] = ty
b.types[t] = ty
return ty
}