// SetLocation sets the current debug location. func (d *DIBuilder) SetLocation(b llvm.Builder, pos token.Pos) { if !pos.IsValid() { return } position := d.fset.Position(pos) d.lb = llvm.Metadata{} if position.Filename != d.fnFile && position.Filename != "" { // This can happen rarely, e.g. in init functions. diFile := d.builder.CreateFile(d.remapFilePath(position.Filename), "") d.lb = d.builder.CreateLexicalBlockFile(d.scope(), diFile, 0) } b.SetCurrentDebugLocation(uint(position.Line), uint(position.Column), d.scope(), llvm.Metadata{}) }
// SetLocation sets the current debug location. func (d *DIBuilder) SetLocation(b llvm.Builder, pos token.Pos) { if !pos.IsValid() { return } position := d.fset.Position(pos) d.lb = llvm.Value{nil} if position.Filename != d.fnFile && position.Filename != "" { // This can happen rarely, e.g. in init functions. diFile := d.builder.CreateFile(d.remapFilePath(position.Filename), "") d.lb = d.builder.CreateLexicalBlockFile(d.scope(), diFile, 0) } b.SetCurrentDebugLocation(llvm.MDNode([]llvm.Value{ llvm.ConstInt(llvm.Int32Type(), uint64(position.Line), false), llvm.ConstInt(llvm.Int32Type(), uint64(position.Column), false), d.scope(), llvm.Value{}, })) }