本文整理汇总了Golang中llvm/org/llvm/bindings/go/llvm.Builder.SetCurrentDebugLocation方法的典型用法代码示例。如果您正苦于以下问题:Golang Builder.SetCurrentDebugLocation方法的具体用法?Golang Builder.SetCurrentDebugLocation怎么用?Golang Builder.SetCurrentDebugLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm/org/llvm/bindings/go/llvm.Builder
的用法示例。
在下文中一共展示了Builder.SetCurrentDebugLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetLocation
// 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{})
}
示例2: SetLocation
// 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{},
}))
}