[flang-commits] [flang] [flang][mlir] Add flang to mlir lowering for groupprivate (PR #180934)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Jun 9 08:08:52 PDT 2026


================
@@ -76,8 +76,22 @@ class WithOmpDeclarative {
     ompDeviceType_ = device;
   }
 
+  const OmpClauseSet &ompGroupprivate() const { return ompGroupprivate_; }
+  void set_ompGroupprivate(OmpClauseSet clauses) { ompGroupprivate_ = clauses; }
+
+  const std::optional<common::OmpDeviceType> &
+  ompGroupprivateDeviceType() const {
+    return ompGroupprivateDeviceType_;
+  }
+  void set_ompGroupprivateDeviceType(common::OmpDeviceType device) {
+    ompGroupprivateDeviceType_ = device;
+  }
+
+  // \p deviceType overrides the DEVICE_TYPE clause value to print (used for
+  // GROUPPRIVATE); when absent the DECLARE_TARGET device_type is used.
   void printClauseSet(llvm::raw_ostream &os, const OmpClauseSet &clauses,
-      parser::CharBlock name = parser::CharBlock{}) const;
+      parser::CharBlock name = parser::CharBlock{},
+      std::optional<common::OmpDeviceType> deviceType = std::nullopt) const;
----------------
skatrak wrote:

I'd suggest passing in the enum value of the OpenMP directive for which these clauses are being printed instead a specific `deviceType` override. That would be a more general solution that would work for other clause clashes in the future without changes to the API.

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


More information about the flang-commits mailing list