Skip to content

Commit e562960

Browse files
committed
[bindings/go] Add DebugLoc parameter to InsertXXXAtEnd()
These functions previously passed nil for the location, which always resulted in a crash. This is a signature breaking change, but I cannot see how they could have been used before. Patch by Ben Clayton! Differential Revision: https://reviews.llvm.org/D51970 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342179 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 62d12ed commit e562960

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bindings/go/llvm/dibuilder.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,19 @@ func (d *DIBuilder) CreateExpression(addr []int64) Metadata {
565565

566566
// InsertDeclareAtEnd inserts a call to llvm.dbg.declare at the end of the
567567
// specified basic block for the given value and associated debug metadata.
568-
func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
569-
result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
568+
func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value {
569+
loc := C.LLVMDIBuilderCreateDebugLocation(
570+
d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C)
571+
result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C)
570572
return Value{C: result}
571573
}
572574

573575
// InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the
574576
// specified basic block for the given value and associated debug metadata.
575-
func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
576-
result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
577+
func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value {
578+
loc := C.LLVMDIBuilderCreateDebugLocation(
579+
d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C)
580+
result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C)
577581
return Value{C: result}
578582
}
579583

0 commit comments

Comments
 (0)