@@ -389,42 +389,16 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
389
389
}
390
390
}
391
391
392
- static const parser::CharBlock *
393
- getSource (const semantics::SemanticsContext &semaCtx,
394
- const lower::pft::Evaluation &eval) {
395
- const parser::CharBlock *source = nullptr ;
396
-
397
- auto ompConsVisit = [&](const parser::OpenMPConstruct &x) {
398
- std::visit (
399
- common::visitors{
400
- [&](const parser::OpenMPSectionsConstruct &x) {
401
- source = &std::get<0 >(x.t ).source ;
402
- },
403
- [&](const parser::OpenMPLoopConstruct &x) {
404
- source = &std::get<0 >(x.t ).source ;
405
- },
406
- [&](const parser::OpenMPBlockConstruct &x) {
407
- source = &std::get<0 >(x.t ).source ;
408
- },
409
- [&](const parser::OpenMPCriticalConstruct &x) {
410
- source = &std::get<0 >(x.t ).source ;
411
- },
412
- [&](const parser::OpenMPAtomicConstruct &x) {
413
- source = &std::get<parser::OmpDirectiveSpecification>(x.t ).source ;
414
- },
415
- [&](const auto &x) { source = &x.source ; },
416
- },
417
- x.u );
418
- };
419
-
420
- eval.visit (common::visitors{
421
- [&](const parser::OpenMPConstruct &x) { ompConsVisit (x); },
422
- [&](const parser::OpenMPDeclarativeConstruct &x) { source = &x.source ; },
423
- [&](const parser::OmpEndLoopDirective &x) { source = &x.source ; },
424
- [&](const auto &x) {},
392
+ static parser::CharBlock getSource (const semantics::SemanticsContext &semaCtx,
393
+ const lower::pft::Evaluation &eval) {
394
+ return eval.visit (common::visitors{
395
+ [&](const parser::OpenMPConstruct &x) {
396
+ return parser::omp::GetOmpDirectiveName (x).source ;
397
+ },
398
+ [&](const parser::OpenMPDeclarativeConstruct &x) { return x.source ; },
399
+ [&](const parser::OmpEndLoopDirective &x) { return x.source ; },
400
+ [&](const auto &x) { return parser::CharBlock{}; },
425
401
});
426
-
427
- return source;
428
402
}
429
403
430
404
static void collectPrivatizingConstructs (
@@ -518,11 +492,11 @@ void DataSharingProcessor::collectSymbols(
518
492
for (const semantics::Scope &child : scope->children ())
519
493
collectScopes (&child);
520
494
};
521
- const parser::CharBlock * source =
522
- clauses.empty () ? getSource (semaCtx, eval) : & clauses.front ().source ;
495
+ parser::CharBlock source =
496
+ clauses.empty () ? getSource (semaCtx, eval) : clauses.front ().source ;
523
497
const semantics::Scope *curScope = nullptr ;
524
- if (source && !source-> empty ()) {
525
- curScope = &semaCtx.FindScope (* source);
498
+ if (!source. empty ()) {
499
+ curScope = &semaCtx.FindScope (source);
526
500
collectScopes (curScope);
527
501
}
528
502
// Collect all symbols referenced in the evaluation being processed,
0 commit comments