[flang] [llvm] [Flang][OpenMP] Initial defaultmap implementation (PR #135226)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Sat May 10 06:40:59 PDT 2025


================
@@ -856,6 +856,26 @@ static bool isVectorSubscript(const evaluate::Expr<T> &expr) {
   return false;
 }
 
+bool ClauseProcessor::processDefaultMap(lower::StatementContext &stmtCtx,
+                                        DefaultMapsTy &result) const {
+  auto process = [&](const omp::clause::Defaultmap &clause,
+                     const parser::CharBlock &) {
+    using Defmap = omp::clause::Defaultmap;
+    clause::Defaultmap::VariableCategory variableCategory =
+        Defmap::VariableCategory::All;
+    // Variable Category is optional, if not specified defaults to all.
+    // Multiples of the same category are illegal as are any other
+    // defaultmaps being specified when a user specified all is in place,
+    // however, this should be handled earlier during semantics.
+    if (auto varCat =
+            std::get<std::optional<Defmap::VariableCategory>>(clause.t))
+      variableCategory = varCat.value_or(Defmap::VariableCategory::All);
----------------
kparzysz wrote:

`varCat` has a value here (it's guarded by `if`).

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


More information about the llvm-commits mailing list