[Mlir-commits] [flang] [mlir] [mlir][OpenACC][OpenMP] Use explicit attribute APIs (PR #218901)

Sergio Afonso llvmlistbot at llvm.org
Wed Aug 26 06:54:30 PDT 2026


================
@@ -42,6 +42,21 @@ class BlockArgOpenMPClause<string clauseNameSnake, string clauseNameCamel,
     }]
   >;
 
+  // Unified access method for symbols associated with the given clause. The
+  // strict naming scheme for clause arguments lets the default implementation
+  // look up the corresponding inherent attribute directly.
+  InterfaceMethod symsMethod = InterfaceMethod<
+    "Get symbols associated to `" # clauseNameSnake # "`, if present.",
+    "::std::optional<::mlir::ArrayAttr>",
+    "get" # clauseNameCamel # "Syms", (ins), [{}], [{
+      auto attr = $_op->getInherentAttr(
+    }] # "\"" # clauseNameSnake # "_syms\");" # [{
+      if (!attr)
+        return ::std::nullopt;
+      return ::llvm::dyn_cast<::mlir::ArrayAttr>(*attr);
----------------
skatrak wrote:

There should be an auto-generated `getClauseNameSyms()` already created for every operation that holds an entry-block generating OpenMP clause and has symbols associated, based on their tablegen definitions. I'm wondering if we can actually just return `nullptr` on this default definition and let each operation that actually contains the clause override it, just like we do for `getClauseNameVars()` above.

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


More information about the Mlir-commits mailing list