aboutsummaryrefslogtreecommitdiff
path: root/bindings/go/llvm/IRBindings.cpp
diff options
context:
space:
mode:
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));
}