diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /bindings/go/llvm/ir.go | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'bindings/go/llvm/ir.go')
-rw-r--r-- | bindings/go/llvm/ir.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bindings/go/llvm/ir.go b/bindings/go/llvm/ir.go index b263c07c512d..fe191beb3813 100644 --- a/bindings/go/llvm/ir.go +++ b/bindings/go/llvm/ir.go @@ -1226,9 +1226,23 @@ func (b Builder) InsertWithName(instr Value, name string) { func (b Builder) Dispose() { C.LLVMDisposeBuilder(b.C) } // Metadata +type DebugLoc struct { + Line, Col uint + Scope Metadata + InlinedAt Metadata +} func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) { C.LLVMSetCurrentDebugLocation2(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C) } +// Get current debug location. Please do not call this function until setting debug location with SetCurrentDebugLocation() +func (b Builder) GetCurrentDebugLocation() (loc DebugLoc) { + md := C.LLVMGetCurrentDebugLocation2(b.C) + loc.Line = uint(md.Line) + loc.Col = uint(md.Col) + loc.Scope = Metadata{C: md.Scope} + loc.InlinedAt = Metadata{C: md.InlinedAt} + return +} func (b Builder) SetInstDebugLocation(v Value) { C.LLVMSetInstDebugLocation(b.C, v.C) } func (b Builder) InsertDeclare(module Module, storage Value, md Value) Value { f := module.NamedFunction("llvm.dbg.declare") |