Go bindings: introduce Metadata.ReplaceAllUsesWith.
[oota-llvm.git] / bindings / go / llvm / IRBindings.cpp
index 6247fbc3baad9ca60906aa02183cd1a42f9b9e70..3099fa562812517ee2b33f6b31f39eca2a021092 100644 (file)
@@ -75,6 +75,12 @@ void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD) {
   unwrap<Instruction>(Inst)->setMetadata(KindID, N);
 }
 
+void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef MD, LLVMMetadataRef New) {
+  auto *Node = unwrap<MDNodeFwdDecl>(MD);
+  Node->replaceAllUsesWith(unwrap<MDNode>(New));
+  MDNode::deleteTemporary(Node);
+}
+
 void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
                                   unsigned Col, LLVMMetadataRef Scope,
                                   LLVMMetadataRef InlinedAt) {