diff options
| author | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-09 22:31:56 +0000 |
|---|---|---|
| committer | Robert Widmann <devteam.codafi@gmail.com> | 2019-04-09 22:31:56 +0000 |
| commit | 50f726d73a419b8b4c02bf2702943cbf71e5c2a4 (patch) | |
| tree | 7927914271deb194980712afd57dcd4a6c787cf0 /llvm/lib | |
| parent | bec0a45ddce61abcf92db73dbb13867c270ee23e (diff) | |
| download | bcm5719-llvm-50f726d73a419b8b4c02bf2702943cbf71e5c2a4.tar.gz bcm5719-llvm-50f726d73a419b8b4c02bf2702943cbf71e5c2a4.zip | |
[LLVM-C] Correct The Current Debug Location Accessors
Summary: Deprecate the existing accessors for the "current debug location" of an IRBuilder. The setter could not handle being reset to NULL, and the getter would create bogus metadata if the NULL location was returned. Provide direct metadata-based accessors instead.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60484
llvm-svn: 358039
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Core.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 997f5330dec..44291a1784d 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -3006,6 +3006,17 @@ void LLVMDisposeBuilder(LLVMBuilderRef Builder) { /*--.. Metadata builders ...................................................--*/ +LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder) { + return wrap(unwrap(Builder)->getCurrentDebugLocation().getAsMDNode()); +} + +void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc) { + if (Loc) + unwrap(Builder)->SetCurrentDebugLocation(DebugLoc(unwrap<MDNode>(Loc))); + else + unwrap(Builder)->SetCurrentDebugLocation(DebugLoc()); +} + void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L) { MDNode *Loc = L ? cast<MDNode>(unwrap<MetadataAsValue>(L)->getMetadata()) : nullptr; @@ -3022,7 +3033,6 @@ void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst) { unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst)); } - /*--.. Instruction builders ................................................--*/ LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B) { |

