@@ -2780,8 +2780,6 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
27802780
27812781// Following clauses do not have a separate node in parse-tree.h.
27822782CHECK_SIMPLE_CLAUSE (Absent, OMPC_absent)
2783- CHECK_SIMPLE_CLAUSE (AcqRel, OMPC_acq_rel)
2784- CHECK_SIMPLE_CLAUSE (Acquire, OMPC_acquire)
27852783CHECK_SIMPLE_CLAUSE (Affinity, OMPC_affinity)
27862784CHECK_SIMPLE_CLAUSE (Capture, OMPC_capture)
27872785CHECK_SIMPLE_CLAUSE (Contains, OMPC_contains)
@@ -2817,9 +2815,6 @@ CHECK_SIMPLE_CLAUSE(Nogroup, OMPC_nogroup)
28172815CHECK_SIMPLE_CLAUSE (Notinbranch, OMPC_notinbranch)
28182816CHECK_SIMPLE_CLAUSE (Partial, OMPC_partial)
28192817CHECK_SIMPLE_CLAUSE (ProcBind, OMPC_proc_bind)
2820- CHECK_SIMPLE_CLAUSE (Release, OMPC_release)
2821- CHECK_SIMPLE_CLAUSE (Relaxed, OMPC_relaxed)
2822- CHECK_SIMPLE_CLAUSE (SeqCst, OMPC_seq_cst)
28232818CHECK_SIMPLE_CLAUSE (Simd, OMPC_simd)
28242819CHECK_SIMPLE_CLAUSE (Sizes, OMPC_sizes)
28252820CHECK_SIMPLE_CLAUSE (Permutation, OMPC_permutation)
@@ -2847,7 +2842,6 @@ CHECK_SIMPLE_CLAUSE(Compare, OMPC_compare)
28472842CHECK_SIMPLE_CLAUSE (CancellationConstructType, OMPC_cancellation_construct_type)
28482843CHECK_SIMPLE_CLAUSE (OmpxAttribute, OMPC_ompx_attribute)
28492844CHECK_SIMPLE_CLAUSE (OmpxBare, OMPC_ompx_bare)
2850- CHECK_SIMPLE_CLAUSE (Fail, OMPC_fail)
28512845CHECK_SIMPLE_CLAUSE (Weak, OMPC_weak)
28522846
28532847CHECK_REQ_SCALAR_INT_CLAUSE (NumTeams, OMPC_num_teams)
@@ -2860,6 +2854,53 @@ CHECK_REQ_CONSTANT_SCALAR_INT_CLAUSE(Collapse, OMPC_collapse)
28602854CHECK_REQ_CONSTANT_SCALAR_INT_CLAUSE (Safelen, OMPC_safelen)
28612855CHECK_REQ_CONSTANT_SCALAR_INT_CLAUSE (Simdlen, OMPC_simdlen)
28622856
2857+ void OmpStructureChecker::Enter (const parser::OmpClause::AcqRel &) {
2858+ if (!isFailClause)
2859+ CheckAllowedClause (llvm::omp::Clause::OMPC_acq_rel);
2860+ }
2861+
2862+ void OmpStructureChecker::Enter (const parser::OmpClause::Acquire &) {
2863+ if (!isFailClause)
2864+ CheckAllowedClause (llvm::omp::Clause::OMPC_acquire);
2865+ }
2866+
2867+ void OmpStructureChecker::Enter (const parser::OmpClause::Release &) {
2868+ if (!isFailClause)
2869+ CheckAllowedClause (llvm::omp::Clause::OMPC_release);
2870+ }
2871+
2872+ void OmpStructureChecker::Enter (const parser::OmpClause::Relaxed &) {
2873+ if (!isFailClause)
2874+ CheckAllowedClause (llvm::omp::Clause::OMPC_relaxed);
2875+ }
2876+
2877+ void OmpStructureChecker::Enter (const parser::OmpClause::SeqCst &) {
2878+ if (!isFailClause)
2879+ CheckAllowedClause (llvm::omp::Clause::OMPC_seq_cst);
2880+ }
2881+
2882+ void OmpStructureChecker::Enter (const parser::OmpClause::Fail &) {
2883+ assert (!isFailClause && " Unexpected FAIL clause inside a FAIL clause?" );
2884+ isFailClause = true ;
2885+ CheckAllowedClause (llvm::omp::Clause::OMPC_fail);
2886+ }
2887+
2888+ void OmpStructureChecker::Leave (const parser::OmpClause::Fail &) {
2889+ assert (isFailClause && " Expected to be inside a FAIL clause here" );
2890+ isFailClause = false ;
2891+ }
2892+
2893+ void OmpStructureChecker::Enter (const parser::OmpFailClause &) {
2894+ assert (!isFailClause && " Unexpected FAIL clause inside a FAIL clause?" );
2895+ isFailClause = true ;
2896+ CheckAllowedClause (llvm::omp::Clause::OMPC_fail);
2897+ }
2898+
2899+ void OmpStructureChecker::Leave (const parser::OmpFailClause &) {
2900+ assert (isFailClause && " Expected to be inside a FAIL clause here" );
2901+ isFailClause = false ;
2902+ }
2903+
28632904// Restrictions specific to each clause are implemented apart from the
28642905// generalized restrictions.
28652906
0 commit comments