@@ -554,18 +554,16 @@ void OmpStructureChecker::CheckHintClause(
554
554
D *leftOmpClauseList, D *rightOmpClauseList) {
555
555
auto checkForValidHintClause = [&](const D *clauseList) {
556
556
for (const auto &clause : clauseList->v ) {
557
- const Fortran::parser::OmpClause *ompClause = nullptr ;
558
- if constexpr (std::is_same_v<D,
559
- const Fortran::parser::OmpAtomicClauseList>) {
560
- ompClause = std::get_if<Fortran::parser::OmpClause>(&clause.u );
557
+ const parser::OmpClause *ompClause = nullptr ;
558
+ if constexpr (std::is_same_v<D, const parser::OmpAtomicClauseList>) {
559
+ ompClause = std::get_if<parser::OmpClause>(&clause.u );
561
560
if (!ompClause)
562
561
continue ;
563
- } else if constexpr (std::is_same_v<D,
564
- const Fortran::parser::OmpClauseList>) {
562
+ } else if constexpr (std::is_same_v<D, const parser::OmpClauseList>) {
565
563
ompClause = &clause;
566
564
}
567
- if (const Fortran:: parser::OmpClause::Hint *hintClause{
568
- std::get_if<Fortran:: parser::OmpClause::Hint>(&ompClause->u )}) {
565
+ if (const parser::OmpClause::Hint *hintClause{
566
+ std::get_if<parser::OmpClause::Hint>(&ompClause->u )}) {
569
567
std::optional<std::int64_t > hintValue = GetIntValue (hintClause->v );
570
568
if (hintValue && *hintValue >= 0 ) {
571
569
/* `omp_sync_hint_nonspeculative` and `omp_lock_hint_speculative`*/
@@ -793,7 +791,7 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
793
791
// TODO: Check for declare simd regions.
794
792
bool eligibleSIMD{false };
795
793
common::visit (
796
- Fortran:: common::visitors{
794
+ common::visitors{
797
795
// Allow `!$OMP ORDERED SIMD`
798
796
[&](const parser::OpenMPBlockConstruct &c) {
799
797
const auto &beginBlockDir{
@@ -2121,7 +2119,7 @@ void OmpStructureChecker::CheckCancellationNest(
2121
2119
eligibleCancellation = true ;
2122
2120
}
2123
2121
break ;
2124
- case Fortran:: parser::OmpCancelType::Type::Do:
2122
+ case parser::OmpCancelType::Type::Do:
2125
2123
if (llvm::omp::nestedCancelDoAllowedSet.test (
2126
2124
GetContextParent ().directive )) {
2127
2125
eligibleCancellation = true ;
@@ -2162,7 +2160,7 @@ void OmpStructureChecker::CheckCancellationNest(
2162
2160
parser::ToUpperCaseLetters (
2163
2161
parser::OmpCancelType::EnumToString (type)));
2164
2162
break ;
2165
- case Fortran:: parser::OmpCancelType::Type::Do:
2163
+ case parser::OmpCancelType::Type::Do:
2166
2164
context_.Say (source,
2167
2165
" %s %s directive is not closely nested inside "
2168
2166
" the construct that matches the DO clause type" _err_en_US,
@@ -2228,9 +2226,9 @@ inline void OmpStructureChecker::ErrIfAllocatableVariable(
2228
2226
const auto &designator =
2229
2227
std::get<common::Indirection<parser::Designator>>(var.u );
2230
2228
const auto *dataRef =
2231
- std::get_if<Fortran:: parser::DataRef>(&designator.value ().u );
2232
- const Fortran:: parser::Name *name =
2233
- dataRef ? std::get_if<Fortran:: parser::Name>(&dataRef->u ) : nullptr ;
2229
+ std::get_if<parser::DataRef>(&designator.value ().u );
2230
+ const parser::Name *name =
2231
+ dataRef ? std::get_if<parser::Name>(&dataRef->u ) : nullptr ;
2234
2232
if (name)
2235
2233
context_.Say (name->source ,
2236
2234
" %s must not have ALLOCATABLE "
@@ -2250,10 +2248,8 @@ inline void OmpStructureChecker::ErrIfLHSAndRHSSymbolsMatch(
2250
2248
const Symbol &varSymbol = vSyms.front ();
2251
2249
for (const Symbol &symbol : evaluate::GetSymbolVector (*e)) {
2252
2250
if (varSymbol == symbol) {
2253
- const Fortran::common::Indirection<Fortran::parser::Designator>
2254
- *designator = std::get_if<
2255
- Fortran::common::Indirection<Fortran::parser::Designator>>(
2256
- &expr.u );
2251
+ const common::Indirection<parser::Designator> *designator =
2252
+ std::get_if<common::Indirection<parser::Designator>>(&expr.u );
2257
2253
if (designator) {
2258
2254
auto *z{var.typedExpr .get ()};
2259
2255
auto *c{expr.typedExpr .get ()};
@@ -2334,10 +2330,9 @@ void OmpStructureChecker::CheckAtomicCaptureStmt(
2334
2330
common::visitors{
2335
2331
[&](const common::Indirection<parser::Designator> &designator) {
2336
2332
const auto *dataRef =
2337
- std::get_if<Fortran::parser::DataRef>(&designator.value ().u );
2338
- const auto *name = dataRef
2339
- ? std::get_if<Fortran::parser::Name>(&dataRef->u )
2340
- : nullptr ;
2333
+ std::get_if<parser::DataRef>(&designator.value ().u );
2334
+ const auto *name =
2335
+ dataRef ? std::get_if<parser::Name>(&dataRef->u ) : nullptr ;
2341
2336
if (name && IsAllocatable (*name->symbol ))
2342
2337
context_.Say (name->source ,
2343
2338
" %s must not have ALLOCATABLE "
@@ -2470,23 +2465,21 @@ void OmpStructureChecker::CheckAtomicCompareConstruct(
2470
2465
// TODO: Allow cond-update-stmt once compare clause is supported.
2471
2466
void OmpStructureChecker::CheckAtomicCaptureConstruct (
2472
2467
const parser::OmpAtomicCapture &atomicCaptureConstruct) {
2473
- const Fortran::parser::AssignmentStmt &stmt1 =
2474
- std::get<Fortran::parser::OmpAtomicCapture::Stmt1>(
2475
- atomicCaptureConstruct.t )
2468
+ const parser::AssignmentStmt &stmt1 =
2469
+ std::get<parser::OmpAtomicCapture::Stmt1>(atomicCaptureConstruct.t )
2476
2470
.v .statement ;
2477
- const auto &stmt1Var{std::get<Fortran:: parser::Variable>(stmt1.t )};
2478
- const auto &stmt1Expr{std::get<Fortran:: parser::Expr>(stmt1.t )};
2471
+ const auto &stmt1Var{std::get<parser::Variable>(stmt1.t )};
2472
+ const auto &stmt1Expr{std::get<parser::Expr>(stmt1.t )};
2479
2473
2480
- const Fortran::parser::AssignmentStmt &stmt2 =
2481
- std::get<Fortran::parser::OmpAtomicCapture::Stmt2>(
2482
- atomicCaptureConstruct.t )
2474
+ const parser::AssignmentStmt &stmt2 =
2475
+ std::get<parser::OmpAtomicCapture::Stmt2>(atomicCaptureConstruct.t )
2483
2476
.v .statement ;
2484
- const auto &stmt2Var{std::get<Fortran:: parser::Variable>(stmt2.t )};
2485
- const auto &stmt2Expr{std::get<Fortran:: parser::Expr>(stmt2.t )};
2477
+ const auto &stmt2Var{std::get<parser::Variable>(stmt2.t )};
2478
+ const auto &stmt2Expr{std::get<parser::Expr>(stmt2.t )};
2486
2479
2487
- if (Fortran:: semantics::checkForSingleVariableOnRHS (stmt1)) {
2480
+ if (semantics::checkForSingleVariableOnRHS (stmt1)) {
2488
2481
CheckAtomicCaptureStmt (stmt1);
2489
- if (Fortran:: semantics::checkForSymbolMatch (stmt2)) {
2482
+ if (semantics::checkForSymbolMatch (stmt2)) {
2490
2483
// ATOMIC CAPTURE construct is of the form [capture-stmt, update-stmt]
2491
2484
CheckAtomicUpdateStmt (stmt2);
2492
2485
} else {
@@ -2500,8 +2493,8 @@ void OmpStructureChecker::CheckAtomicCaptureConstruct(
2500
2493
" Captured variable/array element/derived-type component %s expected to be assigned in the second statement of ATOMIC CAPTURE construct" _err_en_US,
2501
2494
stmt1Expr.source );
2502
2495
}
2503
- } else if (Fortran:: semantics::checkForSymbolMatch (stmt1) &&
2504
- Fortran:: semantics::checkForSingleVariableOnRHS (stmt2)) {
2496
+ } else if (semantics::checkForSymbolMatch (stmt1) &&
2497
+ semantics::checkForSingleVariableOnRHS (stmt2)) {
2505
2498
// ATOMIC CAPTURE construct is of the form [update-stmt, capture-stmt]
2506
2499
CheckAtomicUpdateStmt (stmt1);
2507
2500
CheckAtomicCaptureStmt (stmt2);
@@ -2524,28 +2517,28 @@ void OmpStructureChecker::CheckAtomicMemoryOrderClause(
2524
2517
const parser::OmpAtomicClauseList *rightHandClauseList) {
2525
2518
int numMemoryOrderClause{0 };
2526
2519
int numFailClause{0 };
2527
- auto checkForValidMemoryOrderClause =
2528
- [&](const parser::OmpAtomicClauseList *clauseList) {
2529
- for (const auto &clause : clauseList->v ) {
2530
- if (std::get_if<parser::OmpFailClause>(&clause.u )) {
2531
- numFailClause++;
2532
- if (numFailClause > 1 ) {
2533
- context_.Say (clause.source ,
2534
- " More than one FAIL clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2535
- return ;
2536
- }
2537
- } else {
2538
- if (std::get_if<Fortran::parser::OmpMemoryOrderClause>(&clause.u )) {
2539
- numMemoryOrderClause++;
2540
- if (numMemoryOrderClause > 1 ) {
2541
- context_.Say (clause.source ,
2542
- " More than one memory order clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2543
- return ;
2544
- }
2545
- }
2520
+ auto checkForValidMemoryOrderClause = [&](const parser::OmpAtomicClauseList
2521
+ *clauseList) {
2522
+ for (const auto &clause : clauseList->v ) {
2523
+ if (std::get_if<parser::OmpFailClause>(&clause.u )) {
2524
+ numFailClause++;
2525
+ if (numFailClause > 1 ) {
2526
+ context_.Say (clause.source ,
2527
+ " More than one FAIL clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2528
+ return ;
2529
+ }
2530
+ } else {
2531
+ if (std::get_if<parser::OmpMemoryOrderClause>(&clause.u )) {
2532
+ numMemoryOrderClause++;
2533
+ if (numMemoryOrderClause > 1 ) {
2534
+ context_.Say (clause.source ,
2535
+ " More than one memory order clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2536
+ return ;
2546
2537
}
2547
2538
}
2548
- };
2539
+ }
2540
+ }
2541
+ };
2549
2542
if (leftHandClauseList) {
2550
2543
checkForValidMemoryOrderClause (leftHandClauseList);
2551
2544
}
0 commit comments