[Mlir-commits] [mlir] [MLIR][LLVM] Share LLVM metadata attribute translation (PR #203016)

Tobias Gysi llvmlistbot at llvm.org
Tue Jul 28 06:58:28 PDT 2026


================
@@ -1567,6 +1567,59 @@ static llvm::MDNode *convertIntegerArrayToMDNode(llvm::LLVMContext &context,
   return llvm::MDNode::get(context, mdValues);
 }
 
+FailureOr<llvm::Metadata *> ModuleTranslation::convertMetadataAttr(
+    Attribute attr, function_ref<InFlightDiagnostic()> emitError) {
+  llvm::LLVMContext &llvmContext = getLLVMContext();
+
+  return llvm::TypeSwitch<Attribute, FailureOr<llvm::Metadata *>>(attr)
+      .Case<MDStringAttr>([&](auto a) -> FailureOr<llvm::Metadata *> {
----------------
gysit wrote:

```suggestion
      .Case([&](MDStringAttr a) -> FailureOr<llvm::Metadata *> {
```
nit: I believe we can move the type into the lambda, here and below?

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


More information about the Mlir-commits mailing list