Index: llvm/trunk/bindings/go/llvm/DIBuilderBindings.h =================================================================== --- llvm/trunk/bindings/go/llvm/DIBuilderBindings.h +++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.h @@ -116,6 +116,13 @@ LLVMValueRef Expr, LLVMBasicBlockRef Block); +LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D, + LLVMValueRef Val, + uint64_t Offset, + LLVMValueRef VarInfo, + LLVMValueRef Expr, + LLVMBasicBlockRef Block); + #ifdef __cplusplus } // extern "C" #endif Index: llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp =================================================================== --- llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp +++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp @@ -19,8 +19,7 @@ using namespace llvm; namespace { -template -T unwrapDI(LLVMValueRef v) { +template T unwrapDI(LLVMValueRef v) { return v ? T(unwrap(v)) : T(); } } @@ -220,3 +219,15 @@ unwrapDI(Expr), unwrap(Block)); return wrap(Instr); } + +LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref, + LLVMValueRef Val, uint64_t Offset, + LLVMValueRef VarInfo, + LLVMValueRef Expr, + LLVMBasicBlockRef Block) { + DIBuilder *D = unwrap(Dref); + Instruction *Instr = D->insertDbgValueIntrinsic( + unwrap(Val), Offset, unwrapDI(VarInfo), + unwrapDI(Expr), unwrap(Block)); + return wrap(Instr); +} Index: llvm/trunk/bindings/go/llvm/dibuilder.go =================================================================== --- llvm/trunk/bindings/go/llvm/dibuilder.go +++ llvm/trunk/bindings/go/llvm/dibuilder.go @@ -484,6 +484,13 @@ 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, diVarInfo, expr Value, offset uint64, bb BasicBlock) Value { + result := C.LLVMDIBuilderInsertValueAtEnd(d.ref, v.C, C.uint64_t(offset), diVarInfo.C, expr.C, bb.C) + return Value{C: result} +} + func boolToCInt(v bool) C.int { if v { return 1