From 11c5bf2a6526e29410536163fc164339272a064c Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Sat, 13 Dec 2014 02:25:54 +0000 Subject: [PATCH] Go bindings: introduce llvm.TemporaryMDNode. llvm-svn: 224178 --- llvm/bindings/go/llvm/IRBindings.cpp | 6 ++++++ llvm/bindings/go/llvm/IRBindings.h | 2 ++ llvm/bindings/go/llvm/ir.go | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/llvm/bindings/go/llvm/IRBindings.cpp b/llvm/bindings/go/llvm/IRBindings.cpp index 3099fa5..e471746 100644 --- a/llvm/bindings/go/llvm/IRBindings.cpp +++ b/llvm/bindings/go/llvm/IRBindings.cpp @@ -60,6 +60,12 @@ LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs, MDNode::get(*unwrap(C), ArrayRef(unwrap(MDs), Count))); } +LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs, + unsigned Count) { + return wrap(MDNode::getTemporary(*unwrap(C), + ArrayRef(unwrap(MDs), Count))); +} + void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name, LLVMMetadataRef Val) { NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(name); diff --git a/llvm/bindings/go/llvm/IRBindings.h b/llvm/bindings/go/llvm/IRBindings.h index 6bce4f7..fab41f2 100644 --- a/llvm/bindings/go/llvm/IRBindings.h +++ b/llvm/bindings/go/llvm/IRBindings.h @@ -40,6 +40,8 @@ void LLVMRemoveFunctionAttr2(LLVMValueRef Fn, uint64_t PA); LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen); LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs, unsigned Count); +LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs, + unsigned Count); void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name, LLVMMetadataRef Val); diff --git a/llvm/bindings/go/llvm/ir.go b/llvm/bindings/go/llvm/ir.go index 178eda3..f4b07af 100644 --- a/llvm/bindings/go/llvm/ir.go +++ b/llvm/bindings/go/llvm/ir.go @@ -749,6 +749,11 @@ func (c Context) MDNode(mds []Metadata) (md Metadata) { md.C = C.LLVMMDNode2(c.C, ptr, nvals) return } +func (c Context) TemporaryMDNode(mds []Metadata) (md Metadata) { + ptr, nvals := llvmMetadataRefs(mds) + md.C = C.LLVMTemporaryMDNode(c.C, ptr, nvals) + return +} // Operations on scalar constants func ConstInt(t Type, n uint64, signExtend bool) (v Value) { -- 2.7.4