[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


================
@@ -1062,15 +1062,27 @@ void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
   unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
 }
 
-int LLVMHasMetadata(LLVMValueRef Inst) {
-  return unwrap<Instruction>(Inst)->hasMetadata();
+int LLVMHasMetadata(LLVMValueRef Ref) {
+  Value *Val = unwrap<Value>(Ref);
+  if (auto I = dyn_cast<Instruction>(Val))
----------------
nikic wrote:

```suggestion
  if (auto *I = dyn_cast<Instruction>(Val))
```
etc.

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


More information about the llvm-commits mailing list