<div>Hello,</div><div><br></div><div>I'm extending some Go bindings to the LLVM C API, and have found the LLVM C API is lacking in support for named metadata. There are functions for getting the number of and values of the operands of named metadata, but there's no way to insert new named metadata into a module, nor to add an operand to existing named metadata. I've attached a patch to make the following modifications:</div>
<div><br></div><div>  * include/llvm-c/Core.h: Removed the existing function LLVMGetNamedMetadataOperands and modified the signature of LLVMGetNamedMetadataNumOperands.</div><div>  * include/llvm-c/Core.h: Added a new opaque type/typedef pair LLVMOpaqueNamedMDNode/LLVMNamedMDNodeRef, and a corresponding DEFINE_ISA_CONVERSION_FUNCTIONS conversion macro.</div>
<div>  * include/llvm-c/Core.h: Added new functions LLVMGetNamedMetadata, LLVMGetOrInsertNamedMetadata, LLVMGetNamedMetadataName, LLVMGetNamedMetadataOperand, and LLVMAddNamedMetadataOperand. These functions operate on the LLVMNamedMDNodeRef type.</div>
<div>  * lib/VMCore/Core.cpp: Functions added/removed according to changes described above.</div><div>  * bindings/ocaml/llvm/llvm_ocaml.c: Modified llvm_get_namedmd to use the new API calls.</div><div><div><br></div><div>
The only reason I can see this change being contentious is due to the removal of LLVMGetNamedMetadataOperands and the change in signature of LLVMGetNamedMetadataNumOperands. I'm not too sure why there was no named metadata type in the C API, and I don't know what the policy of API backwards compatibility is. I hope someone will enlighten me.</div>
<div><br></div><div>This is my first patch to LLVM, please let me know if there's anything I've missed or you'd like done differently.</div><div><br></div><div>Regards,</div><div>--</div>Andrew Wilkins<br><a href="http://awilkins.id.au">http://awilkins.id.au</a>
</div><div><br></div>