diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index 67c377e798cae..ff8ba774a6ce8 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -157,8 +157,8 @@ TYPE_PARSER( "ACQ_REL" >> construct(construct()) || "ALIGNED" >> construct(parenthesized(Parser{})) || - "ALLOCATE" >> - construct(parenthesized(Parser{})) || + "ALLOCATE" >> construct(construct( + parenthesized(Parser{}))) || "ALLOCATOR" >> construct(construct( parenthesized(scalarIntExpr))) || "COLLAPSE" >> construct(construct( diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp index a027c8fc9af69..ed17bac92965c 100644 --- a/flang/lib/Parser/unparse.cpp +++ b/flang/lib/Parser/unparse.cpp @@ -2020,10 +2020,9 @@ class UnparseVisitor { Put(")"); } void Unparse(const OmpAllocateClause &x) { - Word("ALLOCATE("); - Walk(std::get>(x.t), ":"); + Walk(std::get>(x.t)); + Put(":"); Walk(std::get(x.t)); - Put(")"); } void Unparse(const OmpDependSinkVecLength &x) { Walk(std::get(x.t)); diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 978e1c7962a49..58db754593188 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -403,6 +403,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) { // Following clauses do not have a seperate node in parse-tree.h. // They fall under 'struct OmpClause' in parse-tree.h. +CHECK_SIMPLE_CLAUSE(Allocate, OMPC_allocate) CHECK_SIMPLE_CLAUSE(Copyin, OMPC_copyin) CHECK_SIMPLE_CLAUSE(Copyprivate, OMPC_copyprivate) CHECK_SIMPLE_CLAUSE(Device, OMPC_device) @@ -489,7 +490,6 @@ void OmpStructureChecker::CheckIsVarPartOfAnotherVar( } } // Following clauses have a seperate node in parse-tree.h. -CHECK_SIMPLE_PARSER_CLAUSE(OmpAllocateClause, OMPC_allocate) CHECK_SIMPLE_PARSER_CLAUSE(OmpDefaultClause, OMPC_default) CHECK_SIMPLE_PARSER_CLAUSE(OmpDistScheduleClause, OMPC_dist_schedule) CHECK_SIMPLE_PARSER_CLAUSE(OmpNowait, OMPC_nowait) diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h index 2949568f60447..32da0fb009548 100644 --- a/flang/lib/Semantics/check-omp-structure.h +++ b/flang/lib/Semantics/check-omp-structure.h @@ -127,6 +127,7 @@ class OmpStructureChecker void Leave(const parser::OmpClauseList &); void Enter(const parser::OmpClause &); void Enter(const parser::OmpNowait &); + void Enter(const parser::OmpClause::Allocate &); void Enter(const parser::OmpClause::Allocator &); void Enter(const parser::OmpClause::Inbranch &); void Enter(const parser::OmpClause::Mergeable &); @@ -174,7 +175,6 @@ class OmpStructureChecker void Enter(const parser::OmpAtomicCapture &); void Leave(const parser::OmpAtomic &); void Enter(const parser::OmpAlignedClause &); - void Enter(const parser::OmpAllocateClause &); void Enter(const parser::OmpDefaultClause &); void Enter(const parser::OmpDefaultmapClause &); void Enter(const parser::OmpDependClause &); diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td index 58aa1bf23b685..6ad8fa92084b1 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMP.td +++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -254,7 +254,7 @@ def OMPC_AtomicDefaultMemOrder : Clause<"atomic_default_mem_order"> { } def OMPC_Allocate : Clause<"allocate"> { let clangClass = "OMPAllocateClause"; - let flangClass = "OmpAllocateClause"; + let flangClassValue = "OmpAllocateClause"; } def OMPC_NonTemporal : Clause<"nontemporal"> { let clangClass = "OMPNontemporalClause";