diff --git a/flang/include/flang/Parser/openmp-utils.h b/flang/include/flang/Parser/openmp-utils.h index bf54f970a7d3a..77c31b939e522 100644 --- a/flang/include/flang/Parser/openmp-utils.h +++ b/flang/include/flang/Parser/openmp-utils.h @@ -39,7 +39,6 @@ struct ConstructId { } MAKE_CONSTR_ID(OpenMPDeclarativeAllocate, D::OMPD_allocate); -MAKE_CONSTR_ID(OpenMPDeclarativeAssumes, D::OMPD_assumes); MAKE_CONSTR_ID(OpenMPDeclareReductionConstruct, D::OMPD_declare_reduction); MAKE_CONSTR_ID(OpenMPExecutableAllocate, D::OMPD_allocate); MAKE_CONSTR_ID(OpenMPRequiresConstruct, D::OMPD_requires); @@ -94,7 +93,6 @@ struct DirectiveNameScope { if constexpr (std::is_base_of_v) { return std::get(x.t).DirName(); } else if constexpr (std::is_same_v || - std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v) { diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h index 486be8b60ff8c..bd55166eb9f80 100644 --- a/flang/include/flang/Parser/parse-tree.h +++ b/flang/include/flang/Parser/parse-tree.h @@ -4877,8 +4877,8 @@ struct OpenMPUtilityConstruct { // ASSUMES absent-clause | contains-clause | holds-clause | no-openmp-clause | // no-openmp-routines-clause | no-parallelism-clause struct OpenMPDeclarativeAssumes { - TUPLE_CLASS_BOILERPLATE(OpenMPDeclarativeAssumes); - std::tuple t; + WRAPPER_CLASS_BOILERPLATE( + OpenMPDeclarativeAssumes, OmpDirectiveSpecification); CharBlock source; }; diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index bd080386c0aea..5fd3c1768a17f 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -1853,7 +1853,9 @@ TYPE_PARSER( // Assumes Construct TYPE_PARSER(sourced(construct( - verbatim("ASSUMES"_tok), Parser{}))) + predicated(OmpDirectiveNameParser{}, + IsDirective(llvm::omp::Directive::OMPD_assumes)) >= + Parser{}))) // Declarative constructs TYPE_PARSER( diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp index a2b0b9ef3196c..9812a656092ac 100644 --- a/flang/lib/Parser/unparse.cpp +++ b/flang/lib/Parser/unparse.cpp @@ -2558,8 +2558,8 @@ class UnparseVisitor { void Unparse(const OpenMPDeclarativeAssumes &x) { BeginOpenMP(); - Word("!$OMP ASSUMES "); - Walk(std::get(x.t)); + Word("!$OMP "); + Walk(x.v); Put("\n"); EndOpenMP(); } diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 9c1c614654b51..9d73b8dfc29d5 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -620,10 +620,6 @@ template struct DirectiveSpellingVisitor { checker_(GetDirName(x.t).source, Directive::OMPD_allocators); return false; } - bool Pre(const parser::OpenMPDeclarativeAssumes &x) { - checker_(std::get(x.t).source, Directive::OMPD_assumes); - return false; - } bool Pre(const parser::OpenMPGroupprivate &x) { checker_(x.v.DirName().source, Directive::OMPD_groupprivate); return false; diff --git a/flang/test/Parser/OpenMP/assumption.f90 b/flang/test/Parser/OpenMP/assumption.f90 index 0f333f99f9085..86cbad9e42f78 100644 --- a/flang/test/Parser/OpenMP/assumption.f90 +++ b/flang/test/Parser/OpenMP/assumption.f90 @@ -141,9 +141,11 @@ program p end program p !UNPARSE: PROGRAM p -!UNPARSE: !$OMP ASSUMES NO_OPENMP +!UNPARSE: !$OMP ASSUMES NO_OPENMP !UNPARSE: END PROGRAM p -!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes -!PARSE-TREE: | Verbatim +!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes -> OmpDirectiveSpecification +!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = assumes !PARSE-TREE: | OmpClauseList -> OmpClause -> NoOpenmp +!PARSE-TREE: | Flags = None +!PARSE-TREE: ImplicitPart ->