diff options
author | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-09 22:27:51 +0000 |
---|---|---|
committer | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-09 22:27:51 +0000 |
commit | bec0a45ddce61abcf92db73dbb13867c270ee23e (patch) | |
tree | a8e3e07950bbebf1f691989ca13e239dd02c2248 /llvm/lib/IR/DebugInfo.cpp | |
parent | d1ba3b13f83ebb7a76b62cacb1a97006c8d9f4b3 (diff) | |
download | bcm5719-llvm-bec0a45ddce61abcf92db73dbb13867c270ee23e.tar.gz bcm5719-llvm-bec0a45ddce61abcf92db73dbb13867c270ee23e.zip |
[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
llvm-svn: 358038
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index a9d91214a80..ef21b6a555f 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -1355,6 +1355,17 @@ void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP) { unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP)); } +LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst) { + return wrap(unwrap<Instruction>(Inst)->getDebugLoc().getAsMDNode()); +} + +void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc) { + if (Loc) + unwrap<Instruction>(Inst)->setDebugLoc(DebugLoc(unwrap<MDNode>(Loc))); + else + unwrap<Instruction>(Inst)->setDebugLoc(DebugLoc()); +} + LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata) { switch(unwrap(Metadata)->getMetadataID()) { #define HANDLE_METADATA_LEAF(CLASS) \ |