[clang] [OpenMP] Add runtime selection for metadirective with non-constant conditions. (PR #192455)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Sat May 9 06:49:56 PDT 2026
================
@@ -7953,6 +7953,26 @@ setBranchProtectedScope(Sema &SemaRef, OpenMPDirectiveKind DKind, Stmt *AStmt) {
return CS;
}
+StmtResult SemaOpenMP::ActOnOpenMPMetaDirective(ArrayRef<OMPClause *> Clauses,
+ Stmt *AStmt,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ ArrayRef<Expr *> Conditions,
+ ArrayRef<Stmt *> Directives) {
+ assert(Conditions.size() == Directives.size() &&
+ "Conditions and Directives must have the same size");
+
+ // Determine if any condition is a non-constant runtime expression.
+ // If all conditions are constant (or this is a compile-time-only
+ // metadirective), IfStmt will already have been resolved by the caller
+ // and Conditions/Directives may be empty.
+ Stmt *IfStmt = Conditions.empty() ? AStmt : nullptr;
+ Stmt *AssocStmt = Conditions.empty() ? nullptr : AStmt;
----------------
alexey-bataev wrote:
Misleading, not called with empty conditions. Should be asserts instead?
https://github.com/llvm/llvm-project/pull/192455
More information about the cfe-commits
mailing list