[PATCH] D144634: [Clang][OpenMP] Support for Code Generation of loop bind clause

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 10:38:59 PDT 2023


ABataev added inline comments.


================
Comment at: clang/lib/AST/StmtOpenMP.cpp:2362
+    const HelperExprs &Exprs) {
+  this->LoopDirCrParmV = new LoopDirCrParam(C, StartLoc, EndLoc, CollapsedNum,
+                                            Clauses, AssociatedStmt, Exprs);
----------------
We use tail allocation, this is definetely a mem leak.


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:7815-7851
+  for (const auto *C : S.getClausesOfKind<OMPBindClause>()) {
+    OpenMPBindClauseKind bindParam = C->getBindKind();
+    switch (bindParam) {
+    case OMPC_BIND_parallel: {
+      OMPForDirective *ompForD = OMPForDirective::Create(
+          *(S.LoopDirCrParmV->C), S.LoopDirCrParmV->StartLoc,
+          S.LoopDirCrParmV->EndLoc, S.LoopDirCrParmV->CollapsedNum, newAClauses,
----------------
This is a bad place for this kind of operation here, it should be handled in Sema


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144634/new/

https://reviews.llvm.org/D144634



More information about the cfe-commits mailing list