Like LLVM 3.0, the C API does not have a function designed to create or modify named metadata. A new feature (LLVMAddNamedMetadataOperand) was recently added to the API after release 3.0.
If you are comfortable creating LLVMs from the source code, you can get this support from the torso. See the Getting Started page on how to create an LLVM. Otherwise, you will have to wait until LLVM 3.1 is released.
When a function is available, it will be a simple call:
LLVMAddNamedMetadataOperand(module, "named_md_name", mdnode);
If there is no metadata named "named_md_name", then it will be created. Otherwise, the existing object will be updated.
source share