[clang] Adding support for iterator in motion clauses. (PR #159112)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 01:00:10 PDT 2025


================
@@ -1310,10 +1314,12 @@ OMPFromClause::CreateEmpty(const ASTContext &C,
   void *Mem = C.Allocate(
       totalSizeToAlloc<Expr *, ValueDecl *, unsigned,
                        OMPClauseMappableExprCommon::MappableComponent>(
-          2 * Sizes.NumVars, Sizes.NumUniqueDeclarations,
+          2 * Sizes.NumVars + 1, Sizes.NumUniqueDeclarations,
           Sizes.NumUniqueDeclarations + Sizes.NumComponentLists,
           Sizes.NumComponents));
-  return new (Mem) OMPFromClause(Sizes);
+  OMPFromClause *Clause = new (Mem) OMPFromClause(Sizes);
+  Clause->setIteratorModifier(nullptr);
----------------
ShashwathiNavada wrote:

If we don’t set this pointer to null, it would take some garbage value resulting in program to crash. Therefore, I thought it would be more clear this way. I also took implementation of iterator in map clause as reference. Let me know if there needs to be any change. Thanks!

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


More information about the cfe-commits mailing list