diff --git a/flang/lib/semantics/check-omp-structure.cc b/flang/lib/semantics/check-omp-structure.cc index 01e4c994845e..e5d7fdcced07 100644 --- a/flang/lib/semantics/check-omp-structure.cc +++ b/flang/lib/semantics/check-omp-structure.cc @@ -131,8 +131,7 @@ void OmpStructureChecker::CheckAllowed(OmpClause type) { } void OmpStructureChecker::CheckRequired(OmpClause c) { - auto *clause{FindClause(c)}; - if (!clause) { + if (!FindClause(c)) { context_.Say(GetContext().directiveSource, "At least one %s clause must appear on the %s directive"_err_en_US, EnumToString(c), ContextDirectiveAsFortran()); @@ -935,14 +934,14 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) { CheckAllowed(OmpClause::MAP); if (const auto &maptype{std::get>(x.t)}) { using Type = parser::OmpMapType::Type; - const Type &type = std::get(maptype->t); + const Type &type{std::get(maptype->t)}; switch (GetContext().directive) { case OmpDirective::TARGET: case OmpDirective::TARGET_DATA: { if (type != Type::To && type != Type::From && type != Type::Tofrom && type != Type::Alloc) { context_.Say(GetContext().clauseSource, - "Only the to, from, tofrom or alloc map types are permitted " + "Only the TO, FROM, TOFROM or ALLOC map types are permitted " "for MAP clauses on the %s directive"_err_en_US, ContextDirectiveAsFortran()); } @@ -950,7 +949,7 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) { case OmpDirective::TARGET_ENTER_DATA: { if (type != Type::To && type != Type::Alloc) { context_.Say(GetContext().clauseSource, - "Only the to or alloc map types are permitted " + "Only the TO or ALLOC map types are permitted " "for MAP clauses on the %s directive"_err_en_US, ContextDirectiveAsFortran()); } @@ -958,7 +957,7 @@ void OmpStructureChecker::Enter(const parser::OmpMapClause &x) { case OmpDirective::TARGET_EXIT_DATA: { if (type != Type::Delete && type != Type::Release && type != Type::From) { context_.Say(GetContext().clauseSource, - "Only the from, release or delete map types are permitted " + "Only the FROM, RELEASE or DELETE map types are permitted " "for MAP clauses on the %s directive"_err_en_US, ContextDirectiveAsFortran()); } diff --git a/flang/test/semantics/omp-device-constructs.f90 b/flang/test/semantics/omp-device-constructs.f90 index e7de678988e5..8fb37d5c8fba 100644 --- a/flang/test/semantics/omp-device-constructs.f90 +++ b/flang/test/semantics/omp-device-constructs.f90 @@ -117,7 +117,7 @@ program main enddo !$omp end target - !ERROR: Only the to, from, tofrom or alloc map types are permitted for MAP clauses on the TARGET directive + !ERROR: Only the TO, FROM, TOFROM or ALLOC map types are permitted for MAP clauses on the TARGET directive !$omp target map(delete:a) do i = 1, N a = 3.14 @@ -140,7 +140,7 @@ program main !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive !$omp target enter data map(to:a) if(.true.) if(.false.) - !ERROR: Only the to or alloc map types are permitted for MAP clauses on the TARGET ENTER DATA directive + !ERROR: Only the TO or ALLOC map types are permitted for MAP clauses on the TARGET ENTER DATA directive !$omp target enter data map(from:a) !$omp target exit data map(delete:a) @@ -148,6 +148,6 @@ program main !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive !$omp target exit data map(from:a) device(0) device(1) - !ERROR: Only the from, release or delete map types are permitted for MAP clauses on the TARGET EXIT DATA directive + !ERROR: Only the FROM, RELEASE or DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive !$omp target exit data map(to:a) end program main