[clang] [llvm] [OpenMP] Add runtime selection for metadirective with non-constant conditions. (PR #192455)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 07:24:56 PDT 2026
================
@@ -2712,6 +2714,153 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
// A single match is returned for OpenMP 5.0
int BestIdx = getBestVariantMatchForContext(VMIs, OMPCtx);
+ // Check if we have user conditions with non-constant expressions that
+ // require runtime selection.
+ bool HasUserCondition = llvm::any_of(VMIs, [](const VariantMatchInfo &VMI) {
+ return VMI.HasNonConstantUserCondition;
+ });
+
+ // Different directives have different data-sharing attributes, so each
+ // variant needs its own CapturedStmt with proper DSA context.
+ // We manually cache body tokens and inject them for each variant parse.
+ if (HasUserCondition) {
----------------
alexey-bataev wrote:
```suggestion
if (HasUserCondition &&
getLangOpts().OpenMPMetadirectiveRuntimeSelection) {
```
https://github.com/llvm/llvm-project/pull/192455
More information about the llvm-commits
mailing list