[flang] [llvm] [flang][OpenMP] Store list of expressions in InitializerT (PR #170923)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 05:54:22 PST 2025


================
@@ -982,21 +982,23 @@ Init make(const parser::OmpClause::Init &inp,
 Initializer make(const parser::OmpClause::Initializer &inp,
                  semantics::SemanticsContext &semaCtx) {
   const parser::OmpInitializerExpression &iexpr = inp.v.v;
-  const parser::OmpStylizedInstance &styleInstance = iexpr.v.front();
-  const parser::OmpStylizedInstance::Instance &instance =
-      std::get<parser::OmpStylizedInstance::Instance>(styleInstance.t);
-  if (const auto *as = std::get_if<parser::AssignmentStmt>(&instance.u)) {
-    auto &expr = std::get<parser::Expr>(as->t);
-    return Initializer{makeExpr(expr, semaCtx)};
-  } else if (const auto *call = std::get_if<parser::CallStmt>(&instance.u)) {
-    if (call->typedCall) {
+  Initializer initializer;
+  for (const parser::OmpStylizedInstance &styleInstance : iexpr.v) {
----------------
kparzysz wrote:

The initializer expression is something like a template (the so called "OpenMP stylized expression"), where the variables `omp_priv` and `omp_orig` can take any type from the list of types on `declare_reduction`.  The way it's implemented in the parser/semantic analysis is that we create a separate expression for each type, where these special variables have concrete declarations.

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


More information about the llvm-commits mailing list