[clang] [OpenMP] [NFC] Use setHelperExprs in OMPTargetGenericLoopDirective::Create. (PR #242023)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 04:47:08 PST 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Zahira Ammarguellat (zahiraam)

<details>
<summary>Changes</summary>

`OMPTargetGenericLoopDirective::Create` was added in #<!-- -->238448 before `OMPLoopDirective::setHelperExprs` was introduced in #<!-- -->238950, so it still sets each helper expression by hand. Use `setHelperExprs` like the other loop directives.

---
Full diff: https://github.com/llvm/llvm-project/pull/242023.diff


1 Files Affected:

- (modified) clang/lib/AST/StmtOpenMP.cpp (+1-24) 


``````````diff
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp
index 7ecbe9b79ac712..0fae9fa63c079c 100644
--- a/clang/lib/AST/StmtOpenMP.cpp
+++ b/clang/lib/AST/StmtOpenMP.cpp
@@ -2060,30 +2060,7 @@ OMPTargetGenericLoopDirective *OMPTargetGenericLoopDirective::Create(
       C, Clauses, AssociatedStmt,
       numLoopChildren(CollapsedNum, OMPD_target_loop), StartLoc, EndLoc,
       CollapsedNum);
-  Dir->setIterationVariable(Exprs.IterationVarRef);
-  Dir->setLastIteration(Exprs.LastIteration);
-  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
-  Dir->setPreCond(Exprs.PreCond);
-  Dir->setCond(Exprs.Cond);
-  Dir->setInit(Exprs.Init);
-  Dir->setInc(Exprs.Inc);
-  Dir->setIsLastIterVariable(Exprs.IL);
-  Dir->setLowerBoundVariable(Exprs.LB);
-  Dir->setUpperBoundVariable(Exprs.UB);
-  Dir->setStrideVariable(Exprs.ST);
-  Dir->setEnsureUpperBound(Exprs.EUB);
-  Dir->setNextLowerBound(Exprs.NLB);
-  Dir->setNextUpperBound(Exprs.NUB);
-  Dir->setNumIterations(Exprs.NumIterations);
-  Dir->setCounters(Exprs.Counters);
-  Dir->setPrivateCounters(Exprs.PrivateCounters);
-  Dir->setInits(Exprs.Inits);
-  Dir->setUpdates(Exprs.Updates);
-  Dir->setFinals(Exprs.Finals);
-  Dir->setDependentCounters(Exprs.DependentCounters);
-  Dir->setDependentInits(Exprs.DependentInits);
-  Dir->setFinalsConditions(Exprs.FinalsConditions);
-  Dir->setPreInits(Exprs.PreInits);
+  Dir->setHelperExprs(Exprs);
   return Dir;
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list