[flang-commits] [flang] 6a1be11 - [Flang][OpenMP][Parser] Add clause list source location to REQUIRES directive

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Aug 15 03:14:38 PDT 2023


Author: Sergio Afonso
Date: 2023-08-15T11:14:05+01:00
New Revision: 6a1be11b6c08437034207b0ec289040d070e54ae

URL: https://github.com/llvm/llvm-project/commit/6a1be11b6c08437034207b0ec289040d070e54ae
DIFF: https://github.com/llvm/llvm-project/commit/6a1be11b6c08437034207b0ec289040d070e54ae.diff

LOG: [Flang][OpenMP][Parser] Add clause list source location to REQUIRES directive

This patch fixes a problem in the representation of the clause list for the
REQUIRES directive. Location information was not present, making error messages
not very descriptive.

This is patch 1/5 of a series splitting D149337 to simplify review.

Differential Revision: https://reviews.llvm.org/D157710

Added: 
    

Modified: 
    flang/lib/Parser/openmp-parsers.cpp
    flang/test/Semantics/OpenMP/requires.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 6d1a3a04b481ef..b30a3a1eb2a151 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -610,7 +610,7 @@ TYPE_PARSER(
 
 // 2.4 Requires construct
 TYPE_PARSER(sourced(construct<OpenMPRequiresConstruct>(
-    verbatim("REQUIRES"_tok), some(Parser<OmpClause>{} / maybe(","_tok)))))
+    verbatim("REQUIRES"_tok), Parser<OmpClauseList>{})))
 
 // 2.15.2 Threadprivate directive
 TYPE_PARSER(sourced(construct<OpenMPThreadprivate>(

diff  --git a/flang/test/Semantics/OpenMP/requires.f90 b/flang/test/Semantics/OpenMP/requires.f90
index e2093ec5032664..007135749cc823 100644
--- a/flang/test/Semantics/OpenMP/requires.f90
+++ b/flang/test/Semantics/OpenMP/requires.f90
@@ -1,4 +1,7 @@
 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
 
-!$omp requires reverse_offload
+!$omp requires reverse_offload unified_shared_memory
+
+!ERROR: NOWAIT clause is not allowed on the REQUIRES directive
+!$omp requires nowait
 end


        


More information about the flang-commits mailing list