aboutsummaryrefslogtreecommitdiff
path: root/bindings/go/llvm/IRBindings.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
commit71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch)
tree5343938942df402b49ec7300a1c25a2d4ccd5821 /bindings/go/llvm/IRBindings.cpp
parent31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff)
Diffstat (limited to 'bindings/go/llvm/IRBindings.cpp')
-rw-r--r--bindings/go/llvm/IRBindings.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/bindings/go/llvm/IRBindings.cpp b/bindings/go/llvm/IRBindings.cpp
index 20cc05043f28..4bfa1bbaf0cc 100644
--- a/bindings/go/llvm/IRBindings.cpp
+++ b/bindings/go/llvm/IRBindings.cpp
@@ -14,6 +14,7 @@
#include "IRBindings.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
@@ -71,6 +72,18 @@ void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
InlinedAt ? unwrap<MDNode>(InlinedAt) : nullptr));
}
+LLVMDebugLocMetadata LLVMGetCurrentDebugLocation2(LLVMBuilderRef Bref) {
+ const auto& Loc = unwrap(Bref)->getCurrentDebugLocation();
+ const auto* InlinedAt = Loc.getInlinedAt();
+ const LLVMDebugLocMetadata md{
+ Loc.getLine(),
+ Loc.getCol(),
+ wrap(Loc.getScope()),
+ InlinedAt == nullptr ? nullptr : wrap(InlinedAt->getRawInlinedAt()),
+ };
+ return md;
+}
+
void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP) {
unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP));
}