[llvm] [LLVM] Add C API support for handling global object metadata. (PR #104786)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 07:26:56 PDT 2024


================
@@ -1088,10 +1100,16 @@ static MDNode *extractMDNode(MetadataAsValue *MAV) {
   return MDNode::get(MAV->getContext(), MD);
 }
 
-void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) {
-  MDNode *N = Val ? extractMDNode(unwrap<MetadataAsValue>(Val)) : nullptr;
+void LLVMSetMetadata(LLVMValueRef Ref, unsigned KindID, LLVMValueRef MAV) {
----------------
nikic wrote:

Hm, we already have LLVMGlobalSetMetadata (which directly takes LLVMMetadataRef rather than this silly MetadataAsValue dance).

So the alternative to this patch would be to add LLVMGlobalGetMetadata/LLVMGlobalHasMetadata instead.

https://github.com/llvm/llvm-project/pull/104786


More information about the llvm-commits mailing list