@@ -18601,22 +18601,14 @@ OMPClause *SemaOpenMP::ActOnOpenMPReductionClause(
18601
18601
// worksharing-loop construct, a worksharing-loop SIMD construct, a simd
18602
18602
// construct, a parallel worksharing-loop construct or a parallel
18603
18603
// worksharing-loop SIMD construct.
18604
- // [5.2:136:1-4] A reduction clause with the inscan reduction-modifier may
18605
- // only appear on a worksharing-loop construct, a simd construct or a
18606
- // combined or composite construct for which any of the aforementioned
18607
- // constructs is a constituent construct and distribute is not a constituent
18608
- // construct.
18609
- if (Modifier == OMPC_REDUCTION_inscan) {
18610
- SmallVector<OpenMPDirectiveKind, 4> LeafOrComposite;
18611
- ArrayRef<OpenMPDirectiveKind> CurrentLOC = getLeafOrCompositeConstructs(
18612
- DSAStack->getCurrentDirective(), LeafOrComposite);
18613
- bool Valid = llvm::any_of(CurrentLOC, [](OpenMPDirectiveKind DK) {
18614
- return llvm::is_contained({OMPD_for, OMPD_simd, OMPD_for_simd}, DK);
18615
- });
18616
- if (!Valid) {
18617
- Diag(ModifierLoc, diag::err_omp_wrong_inscan_reduction);
18618
- return nullptr;
18619
- }
18604
+ if (Modifier == OMPC_REDUCTION_inscan &&
18605
+ (DSAStack->getCurrentDirective() != OMPD_for &&
18606
+ DSAStack->getCurrentDirective() != OMPD_for_simd &&
18607
+ DSAStack->getCurrentDirective() != OMPD_simd &&
18608
+ DSAStack->getCurrentDirective() != OMPD_parallel_for &&
18609
+ DSAStack->getCurrentDirective() != OMPD_parallel_for_simd)) {
18610
+ Diag(ModifierLoc, diag::err_omp_wrong_inscan_reduction);
18611
+ return nullptr;
18620
18612
}
18621
18613
18622
18614
ReductionData RD(VarList.size(), Modifier);
0 commit comments