Skip to content

Commit

Permalink
Go bindings: introduce llvm.TemporaryMDNode.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224178 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Dec 13, 2014
1 parent e9e0f37 commit 3a40431
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bindings/go/llvm/IRBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs,
MDNode::get(*unwrap(C), ArrayRef<Metadata *>(unwrap(MDs), Count)));
}

LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs,
unsigned Count) {
return wrap(MDNode::getTemporary(*unwrap(C),
ArrayRef<Metadata *>(unwrap(MDs), Count)));
}

void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name,
LLVMMetadataRef Val) {
NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(name);
Expand Down
2 changes: 2 additions & 0 deletions bindings/go/llvm/IRBindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions bindings/go/llvm/ir.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3a40431

Please sign in to comment.