Skip to content

Commit acaa026

Browse files
authored
[clang][OpenMP] Use leaf constructs in mapLoopConstruct (#97446)
This removes mentions of specific combined directives. Also, add a quote from the OpenMP spec to explain the code dealing with the `bind` clause.
1 parent 4ee4bc3 commit acaa026

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6270,16 +6270,21 @@ bool SemaOpenMP::mapLoopConstruct(
62706270
if (BindKind == OMPC_BIND_unknown) {
62716271
// Setting the enclosing teams or parallel construct for the loop
62726272
// directive without bind clause.
6273+
// [5.0:129:25-28] If the bind clause is not present on the construct and
6274+
// the loop construct is closely nested inside a teams or parallel
6275+
// construct, the binding region is the corresponding teams or parallel
6276+
// region. If none of those conditions hold, the binding region is not
6277+
// defined.
62736278
BindKind = OMPC_BIND_thread; // Default bind(thread) if binding is unknown
6279+
ArrayRef<OpenMPDirectiveKind> ParentLeafs =
6280+
getLeafConstructsOrSelf(ParentDirective);
62746281

62756282
if (ParentDirective == OMPD_unknown) {
62766283
Diag(DSAStack->getDefaultDSALocation(),
62776284
diag::err_omp_bind_required_on_loop);
6278-
} else if (ParentDirective == OMPD_parallel ||
6279-
ParentDirective == OMPD_target_parallel) {
6285+
} else if (ParentLeafs.back() == OMPD_parallel) {
62806286
BindKind = OMPC_BIND_parallel;
6281-
} else if (ParentDirective == OMPD_teams ||
6282-
ParentDirective == OMPD_target_teams) {
6287+
} else if (ParentLeafs.back() == OMPD_teams) {
62836288
BindKind = OMPC_BIND_teams;
62846289
}
62856290
} else {

0 commit comments

Comments
 (0)