[flang-commits] [flang] [flang] Add parsing of DO CONCURRENT REDUCE clause (PR #92518)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu May 30 08:21:59 PDT 2024


================
@@ -6458,53 +6464,66 @@ bool DeclarationVisitor::PassesSharedLocalityChecks(
   return true;
 }
 
-// Checks for locality-specs LOCAL and LOCAL_INIT
+// Checks for locality-specs LOCAL, LOCAL_INIT, and REDUCE
 bool DeclarationVisitor::PassesLocalityChecks(
-    const parser::Name &name, Symbol &symbol) {
-  if (IsAllocatable(symbol)) { // C1128
+    const parser::Name &name, Symbol &symbol, Symbol::Flag flag) {
+  bool isReduce{flag == Symbol::Flag::LocalityReduce};
+  if (IsAllocatable(symbol) && !isReduce) { // F'2023 C1130
     SayWithDecl(name, symbol,
-        "ALLOCATABLE variable '%s' not allowed in a locality-spec"_err_en_US);
+        "ALLOCATABLE variable '%s' not allowed in a LOCAL%s locality-spec"_err_en_US,
+        flag == Symbol::Flag::LocalityLocalInit ? "_INIT" : "");
----------------
klausler wrote:

Declare `const char *specName{... ? "LOCAL_INIT" : "LOCAL"};` after line 6470 and then use `specName` as the argument, it will be easier to understand than this repetitive conditional suffix.

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


More information about the flang-commits mailing list