From 33d37b2e86702f403b8f22f7e9cc33efaa03625b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 13 Sep 2018 21:16:39 +0000 Subject: [PATCH] [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 llvm-svn: 342179 --- llvm/bindings/go/llvm/dibuilder.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/bindings/go/llvm/dibuilder.go b/llvm/bindings/go/llvm/dibuilder.go index 98382df..1a98c07 100644 --- a/llvm/bindings/go/llvm/dibuilder.go +++ b/llvm/bindings/go/llvm/dibuilder.go @@ -565,15 +565,19 @@ func (d *DIBuilder) CreateExpression(addr []int64) Metadata { // InsertDeclareAtEnd inserts a call to llvm.dbg.declare at the end of the // specified basic block for the given value and associated debug metadata. -func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value { - result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C) +func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value { + loc := C.LLVMDIBuilderCreateDebugLocation( + d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C) + result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C) return Value{C: result} } // InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the // specified basic block for the given value and associated debug metadata. -func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value { - result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C) +func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value { + loc := C.LLVMDIBuilderCreateDebugLocation( + d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C) + result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C) return Value{C: result} } -- 2.7.4