================
@@ -15033,6 +15077,38 @@ static Expr *makeFloorIVRef(Sema &SemaRef, 
ArrayRef<VarDecl *> FloorIndVars,
                           OrigCntVar->getExprLoc());
 }
 
+/// Build loop variable finalization statement from HelperExprs.Finals.
+/// Returns a CompoundStmt containing all finalization statements, or nullptr
+/// if there are no finalization statements.
+/// Note: Loops with non-arithmetic loop variables (e.g., iterators) are 
skipped
+/// because finalization only applies to integer/floating-point counters.
+static Stmt *
+buildLoopFinalization(ASTContext &Context,
+                      ArrayRef<OMPLoopBasedDirective::HelperExprs> LoopHelpers,
+                      ArrayRef<Stmt *> LoopStmts = {}) {
+  bool ShouldFilter = !LoopStmts.empty();
+  assert((!ShouldFilter || LoopHelpers.size() == LoopStmts.size()) &&
+         "LoopHelpers and LoopStmts must have the same size");
+
+  SmallVector<Stmt *, 8> FinalizationStmts;
+
+  for (size_t I = 0; I < LoopHelpers.size(); ++I) {
+    // Filter iterator loops if LoopStmts provided
+    if (ShouldFilter && shouldSkipLoopFinalization(LoopStmts[I]))
----------------
zahiraam wrote:

No. Removed.

https://github.com/llvm/llvm-project/pull/214717
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to