[clang] [clang][OpenMP] Place some common code in functions (PR #96811)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 12:14:54 PDT 2024


================
@@ -3010,6 +3010,28 @@ static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV,
                                      Expr *NumIterations, Sema &SemaRef,
                                      Scope *S, DSAStackTy *Stack);
 
+static bool finishLinearClauses(Sema &SemaRef, ArrayRef<OMPClause *> Clauses,
+                                OMPLoopBasedDirective::HelperExprs &B,
+                                DSAStackTy *Stack) {
+  assert((SemaRef.CurContext->isDependentContext() || B.builtAll()) &&
+         "loop exprs were not built");
+
+  if (SemaRef.CurContext->isDependentContext())
+    return false;
+
+  // Finalize the clauses that need pre-built expressions for CodeGen.
+  for (OMPClause *C : Clauses) {
+    if (auto *LC = dyn_cast<OMPLinearClause>(C)) {
----------------
alexey-bataev wrote:

```
auto *LC = dyn_cast<OMPLinearClause>(C);
if (!LC)
  continue;
```

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


More information about the cfe-commits mailing list