llvm.org GIT mirror llvm / 5a4bf22
Go bindings: add DIBuilder.InsertValueAtEnd Expose llvm::DIBuilder::insertDbgValueIntrinsic as DIBuilder.InsertValueAtEnd in the Go bindings, to support attaching debug metadata to register values. Patch by Andrew Wilkins! Differential Revision: http://reviews.llvm.org/D6374 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222790 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 5 years ago
3 changed file(s) with 27 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1818 using namespace llvm;
1919
2020 namespace {
21 template
22 T unwrapDI(LLVMValueRef v) {
21 template T unwrapDI(LLVMValueRef v) {
2322 return v ? T(unwrap(v)) : T();
2423 }
2524 }
219218 unwrapDI(Expr), unwrap(Block));
220219 return wrap(Instr);
221220 }
221
222 LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref,
223 LLVMValueRef Val, uint64_t Offset,
224 LLVMValueRef VarInfo,
225 LLVMValueRef Expr,
226 LLVMBasicBlockRef Block) {
227 DIBuilder *D = unwrap(Dref);
228 Instruction *Instr = D->insertDbgValueIntrinsic(
229 unwrap(Val), Offset, unwrapDI(VarInfo),
230 unwrapDI(Expr), unwrap(Block));
231 return wrap(Instr);
232 }
115115 LLVMValueRef Expr,
116116 LLVMBasicBlockRef Block);
117117
118 LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef D,
119 LLVMValueRef Val,
120 uint64_t Offset,
121 LLVMValueRef VarInfo,
122 LLVMValueRef Expr,
123 LLVMBasicBlockRef Block);
124
118125 #ifdef __cplusplus
119126 } // extern "C"
120127 #endif
483483 return Value{C: result}
484484 }
485485
486 // InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the
487 // specified basic block for the given value and associated debug metadata.
488 func (d *DIBuilder) InsertValueAtEnd(v, diVarInfo, expr Value, offset uint64, bb BasicBlock) Value {
489 result := C.LLVMDIBuilderInsertValueAtEnd(d.ref, v.C, C.uint64_t(offset), diVarInfo.C, expr.C, bb.C)
490 return Value{C: result}
491 }
492
486493 func boolToCInt(v bool) C.int {
487494 if v {
488495 return 1