llvm.org GIT mirror llvm / 5aa2082
[LLVM-C] Add Bindings to Access an Instruction's DebugLoc Summary: Provide direct accessors to supplement LLVMSetInstDebugLocation. In addition, properly accept and return the NULL location. The old accessors provided no way to do this, so the current debug location cannot currently be cleared. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358038 91177308-0d34-0410-b5e6-96231b3b80d8 Robert Widmann 4 months ago
2 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11921192 void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);
11931193
11941194 /**
1195 * Get the debug location for the given instruction.
1196 *
1197 * @see llvm::Instruction::getDebugLoc()
1198 */
1199 LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst);
1200
1201 /**
1202 * Set the debug location for the given instruction.
1203 *
1204 * To clear the location metadata of the given instruction, pass NULL to \p Loc.
1205 *
1206 * @see llvm::Instruction::setDebugLoc()
1207 */
1208 void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc);
1209
1210 /**
11951211 * Obtain the enumerated type of a Metadata instance.
11961212 *
11971213 * @see llvm::Metadata::getMetadataID()
13541354 unwrap(Func)->setSubprogram(unwrap(SP));
13551355 }
13561356
1357 LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst) {
1358 return wrap(unwrap(Inst)->getDebugLoc().getAsMDNode());
1359 }
1360
1361 void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc) {
1362 if (Loc)
1363 unwrap(Inst)->setDebugLoc(DebugLoc(unwrap(Loc)));
1364 else
1365 unwrap(Inst)->setDebugLoc(DebugLoc());
1366 }
1367
13571368 LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata) {
13581369 switch(unwrap(Metadata)->getMetadataID()) {
13591370 #define HANDLE_METADATA_LEAF(CLASS) \