[OPENMP]Fix datasharing checks for if clause in parallel taskloop
directives.
If the default datasharing is set to none, the datasharing attributes
for variables in the condition of the if clause for the inner taskloop
directive must be verified.
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 1ff25e7..d603d213 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -4766,13 +4766,17 @@
case OMPC_num_threads:
case OMPC_dist_schedule:
// Do not analyse if no parent teams directive.
- if (isOpenMPTeamsDirective(DSAStack->getCurrentDirective()))
+ if (isOpenMPTeamsDirective(Kind))
break;
continue;
case OMPC_if:
- if (isOpenMPTeamsDirective(DSAStack->getCurrentDirective()) &&
+ if (isOpenMPTeamsDirective(Kind) &&
cast<OMPIfClause>(C)->getNameModifier() != OMPD_target)
break;
+ if (isOpenMPParallelDirective(Kind) &&
+ isOpenMPTaskLoopDirective(Kind) &&
+ cast<OMPIfClause>(C)->getNameModifier() != OMPD_parallel)
+ break;
continue;
case OMPC_schedule:
break;
@@ -4781,7 +4785,7 @@
case OMPC_final:
case OMPC_priority:
// Do not analyze if no parent parallel directive.
- if (isOpenMPParallelDirective(DSAStack->getCurrentDirective()))
+ if (isOpenMPParallelDirective(Kind))
break;
continue;
case OMPC_ordered: