[clang] [Clang][Sema][OpenMP] Allow `num_teams` to accept multiple expressions (PR #99732)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 03:23:43 PDT 2024


================
@@ -13034,13 +13034,36 @@ StmtResult SemaOpenMP::ActOnOpenMPTargetUpdateDirective(
                                           Clauses, AStmt);
 }
 
+/// This checks whether a \p ClauseType clause \p C has at most \p Max
+/// expression. If not, a diag of number \p Diag will be emitted.
+template <typename ClauseType>
+static bool checkNumExprsInClause(SemaBase &SemaRef,
+                                  ArrayRef<OMPClause *> Clauses,
+                                  unsigned MaxNum, unsigned Diag) {
+  auto ClauseItr = llvm::find_if(Clauses, llvm::IsaPred<ClauseType>);
+  if (ClauseItr != Clauses.end()) {
----------------
alexey-bataev wrote:

if (ClauseItr == Clauses.end())
  return true;

https://github.com/llvm/llvm-project/pull/99732


More information about the cfe-commits mailing list