[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
Wed Jul 26 11:28:20 PDT 2023


ABataev added inline comments.


================
Comment at: clang/include/clang/AST/StmtOpenMP.h:291
+  /// the frontend.
+  OpenMPDirectiveKind prevMappedDirective;
+
----------------
OpenMPDirectiveKind PrevMappedDirective = llvm::omp::OMPD_unknown;


================
Comment at: clang/include/clang/AST/StmtOpenMP.h:308
+        EndLoc(std::move(EndLoc)),
+        prevMappedDirective(llvm::omp::OMPD_unknown) {}
 
----------------
Remove initialization of prevMappedDirective with the default value from the constructor


================
Comment at: clang/include/clang/AST/StmtOpenMP.h:616
+
+  OpenMPDirectiveKind getMappedDirective() { return prevMappedDirective; }
+
----------------
const member function


================
Comment at: clang/include/clang/Sema/Sema.h:11476
   StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef<OMPClause *> Clauses);
   StmtResult ActOnOpenMPExecutableDirective(
       OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
----------------
All these changed functions are called with the default value of this new prevMappedDirective paramer. Remove.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:6391
     Res = ActOnOpenMPSimdDirective(ClausesWithImplicit, AStmt, StartLoc, EndLoc,
-                                   VarsWithInheritedDSA);
+                                   VarsWithInheritedDSA, prevMappedDirective);
     if (LangOpts.OpenMP >= 50)
----------------
Can you just use DSAStack->getMappedDirective() instead of prevMappedDirective?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:10544
 
-  setFunctionHasBranchProtectedScope();
-  return OMPForDirective::Create(
+  OMPForDirective *ForDirective = OMPForDirective::Create(
       Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B,
----------------
`auto *ForDirective`


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

https://reviews.llvm.org/D144634



More information about the cfe-commits mailing list