[flang-commits] [flang] [flang][openmp]Add UserReductionDetails and use in DECLARE REDUCTION (PR #131628)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Apr 9 08:46:02 PDT 2025


================
@@ -1035,6 +1037,25 @@ void ModFileWriter::PutTypeParam(llvm::raw_ostream &os, const Symbol &symbol) {
   os << '\n';
 }
 
+void ModFileWriter::PutUserReduction(
+    llvm::raw_ostream &os, const Symbol &symbol) {
+  auto &details{symbol.get<UserReductionDetails>()};
+  // The module content for a OpenMP Declare Reduction is the OpenMP
+  // declaration. There may be multiple declarations.
+  // Decls are pointers, so do not use a referene.
+  for (const auto decl : details.GetDeclList()) {
+    if (auto d = std::get_if<const parser::OpenMPDeclareReductionConstruct *>(
----------------
klausler wrote:

Use `common::visit` on a lambda with a `const auto &` argument instead!

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


More information about the flang-commits mailing list