[flang-commits] [libcxxabi] [libc] [flang] [llvm] [lldb] [mlir] [compiler-rt] [clang-tools-extra] [libcxx] [openmp] [clang] [OpenMP] Patch for Support to loop bind clause : Checking Parent Region (PR #76938)

Alexey Bataev via flang-commits flang-commits at lists.llvm.org
Mon Jan 8 08:28:13 PST 2024


================
@@ -6124,35 +6136,39 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
 
 bool Sema::mapLoopConstruct(llvm::SmallVector<OMPClause *> &ClausesWithoutBind,
                             ArrayRef<OMPClause *> Clauses,
-                            OpenMPBindClauseKind BindKind,
+                            OpenMPBindClauseKind &BindKind,
                             OpenMPDirectiveKind &Kind,
-                            OpenMPDirectiveKind &PrevMappedDirective) {
+                            OpenMPDirectiveKind &PrevMappedDirective,
+                            SourceLocation StartLoc, SourceLocation EndLoc,
+                            const DeclarationNameInfo &DirName,
+                            OpenMPDirectiveKind CancelRegion) {
 
   bool UseClausesWithoutBind = false;
 
   // Restricting to "#pragma omp loop bind"
   if (getLangOpts().OpenMP >= 50 && Kind == OMPD_loop) {
+
+    const OpenMPDirectiveKind ParentDirective = DSAStack->getParentDirective();
+
     if (BindKind == OMPC_BIND_unknown) {
       // Setting the enclosing teams or parallel construct for the loop
       // directive without bind clause.
       BindKind = OMPC_BIND_thread; // Default bind(thread) if binding is unknown
 
-      const OpenMPDirectiveKind ParentDirective =
-          DSAStack->getParentDirective();
       if (ParentDirective == OMPD_unknown) {
         Diag(DSAStack->getDefaultDSALocation(),
              diag::err_omp_bind_required_on_loop);
       } else if (ParentDirective == OMPD_parallel ||
-                 ParentDirective == OMPD_target_parallel) {
+                 ParentDirective == OMPD_target_parallel)
         BindKind = OMPC_BIND_parallel;
-      } else if (ParentDirective == OMPD_teams ||
-                 ParentDirective == OMPD_target_teams) {
-        BindKind = OMPC_BIND_teams;
-      }
+    } else if (ParentDirective == OMPD_teams ||
+               ParentDirective == OMPD_target_teams) {
+      BindKind = OMPC_BIND_teams;
----------------
alexey-bataev wrote:

Please restore original code here

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


More information about the flang-commits mailing list