[PATCH] D110270: [flang][OpenMP] Check for occurrence of multiple list items in nontemporal clause for simd directive

Arnamoy B via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 06:27:41 PDT 2021


arnamoy10 added inline comments.
Herald added a project: Flang.


================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:184-192
+    for (auto const &var : alignedNameList) {
+      if (listVars.count(*(var.symbol)) == 1) {
+        context_.Say(itr->second->source,
+            "List item '%s' present at multiple ALIGNED clauses"_err_en_US,
+            var.ToString());
+        break;
+      }
----------------
kiranchandramohan wrote:
> Can you make this a lambda function that takes in a list of variables, with listvars declared inside the lambda and an argument (pass ALIGNED or NONTEMPORAL to it)?
Thanks for the comment.  I was creating a lambda as per your suggestion and passing `alignedClauses`/ `nonTemporalClauses` as the argument and another argument to denote whether we are processing ALIGNED or NONTEMPORAL.

However, in that lambda, how do I declare a generic variable, which will be defined as the following pseudocode based on the passed argument?  It cannot be `auto` e.g. the following will not work.

```
auto &Clause;
if (arg == ALIGNED) 
  Clause = std::get<parser::OmpClause::Aligned>(itr->second->u)};
else
  Clause = std::get<parser::OmpClause::Aligned>(itr->second->u)};
```
What will be the type of `Clause` in this case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110270/new/

https://reviews.llvm.org/D110270



More information about the llvm-commits mailing list