forked from OSchip/llvm-project
[flang] Corrections for map semantics to match coding style
Original-commit: flang-compiler/f18@f2d97c3a1e Reviewed-on: https://github.com/flang-compiler/f18/pull/748 Tree-same-pre-rewrite: false
This commit is contained in:
parent
d3e8c76f67
commit
7c09d48218
|
@ -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<std::optional<parser::OmpMapType>>(x.t)}) {
|
||||
using Type = parser::OmpMapType::Type;
|
||||
const Type &type = std::get<Type>(maptype->t);
|
||||
const Type &type{std::get<Type>(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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue