@@ -1562,20 +1562,11 @@ void OmpStructureChecker::Leave(const parser::OpenMPRequiresConstruct &) {
15621562 dirContext_.pop_back ();
15631563}
15641564
1565- void OmpStructureChecker::CheckAlignValue (const parser::OmpClause &clause) {
1566- if (auto *align{std::get_if<parser::OmpClause::Align>(&clause.u )}) {
1567- if (const auto &v{GetIntValue (align->v )}; v && *v <= 0 ) {
1568- context_.Say (clause.source , " The alignment should be positive" _err_en_US);
1569- }
1570- }
1571- }
1572-
15731565void OmpStructureChecker::Enter (const parser::OpenMPDeclarativeAllocate &x) {
15741566 isPredefinedAllocator = true ;
15751567 const auto &dir{std::get<parser::Verbatim>(x.t )};
15761568 const auto &objectList{std::get<parser::OmpObjectList>(x.t )};
15771569 PushContextAndClauseSets (dir.source , llvm::omp::Directive::OMPD_allocate);
1578- const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
15791570 SymbolSourceMap currSymbols;
15801571 GetSymbolsInObjectList (objectList, currSymbols);
15811572 for (auto &[symbol, source] : currSymbols) {
@@ -1598,9 +1589,6 @@ void OmpStructureChecker::Enter(const parser::OpenMPDeclarativeAllocate &x) {
15981589 source.ToString ());
15991590 }
16001591 }
1601- for (const auto &clause : clauseList.v ) {
1602- CheckAlignValue (clause);
1603- }
16041592 CheckVarIsNotPartOfAnotherVar (dir.source , objectList);
16051593}
16061594
@@ -2007,9 +1995,6 @@ void OmpStructureChecker::Enter(const parser::OpenMPExecutableAllocate &x) {
20071995
20081996 isPredefinedAllocator = true ;
20091997 const auto &objectList{std::get<std::optional<parser::OmpObjectList>>(x.t )};
2010- for (const auto &clause : clauseList.v ) {
2011- CheckAlignValue (clause);
2012- }
20131998 if (objectList) {
20141999 CheckVarIsNotPartOfAnotherVar (dir.source , *objectList);
20152000 }
@@ -3234,7 +3219,6 @@ CHECK_SIMPLE_CLAUSE(AdjustArgs, OMPC_adjust_args)
32343219CHECK_SIMPLE_CLAUSE (AppendArgs, OMPC_append_args)
32353220CHECK_SIMPLE_CLAUSE (MemoryOrder, OMPC_memory_order)
32363221CHECK_SIMPLE_CLAUSE (Bind, OMPC_bind)
3237- CHECK_SIMPLE_CLAUSE (Align, OMPC_align)
32383222CHECK_SIMPLE_CLAUSE (Compare, OMPC_compare)
32393223CHECK_SIMPLE_CLAUSE (OmpxAttribute, OMPC_ompx_attribute)
32403224CHECK_SIMPLE_CLAUSE (Weak, OMPC_weak)
@@ -3898,6 +3882,19 @@ void OmpStructureChecker::CheckIsLoopIvPartOfClause(
38983882 }
38993883}
39003884
3885+ void OmpStructureChecker::Enter (const parser::OmpClause::Align &x) {
3886+ CheckAllowedClause (llvm::omp::Clause::OMPC_align);
3887+ if (const auto &v{GetIntValue (x.v .v )}) {
3888+ if (*v <= 0 ) {
3889+ context_.Say (GetContext ().clauseSource ,
3890+ " The alignment should be positive" _err_en_US);
3891+ } else if (!llvm::isPowerOf2_64 (*v)) {
3892+ context_.Say (GetContext ().clauseSource ,
3893+ " The alignment should be a power of 2" _err_en_US);
3894+ }
3895+ }
3896+ }
3897+
39013898// Restrictions specific to each clause are implemented apart from the
39023899// generalized restrictions.
39033900void OmpStructureChecker::Enter (const parser::OmpClause::Aligned &x) {
0 commit comments