[flang][openacc] Add clause validaty tests for data construct + fix default restriction

Add clause validity tests for the data construct. The default clause can appear only once
and this was not enforce in the ACC.td.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91888
This commit is contained in:
Valentin Clement 2020-12-04 15:12:05 -05:00 committed by clementval
parent 88c21f8488
commit a366188d80
2 changed files with 38 additions and 2 deletions

View File

@ -131,7 +131,42 @@ program openacc_clause_validity
!$acc data
!$acc end data
!$acc data copyin(i)
!$acc data copy(aa) if(.true.)
!$acc end data
!$acc data copy(aa) if(ifCondition)
!$acc end data
!$acc data copy(aa, bb, cc)
!$acc end data
!$acc data copyin(aa) copyin(readonly: bb) copyout(cc)
!$acc end data
!$acc data copyin(readonly: aa, bb) copyout(zero: cc)
!$acc end data
!$acc data create(aa, bb(:,:)) create(zero: cc(:,:))
!$acc end data
!$acc data no_create(aa) present(bb, cc)
!$acc end data
!$acc data deviceptr(aa) attach(bb, cc)
!$acc end data
!$acc data copy(aa, bb) default(none)
!$acc end data
!$acc data copy(aa, bb) default(present)
!$acc end data
!ERROR: At most one DEFAULT clause can appear on the DATA directive
!$acc data copy(aa, bb) default(none) default(present)
!$acc end data
!ERROR: At most one IF clause can appear on the DATA directive
!$acc data copy(aa) if(.true.) if(ifCondition)
!$acc end data
!$acc data copyin(i)

View File

@ -257,7 +257,8 @@ def ACC_Atomic : Directive<"atomic"> {}
// 2.6.5
def ACC_Data : Directive<"data"> {
let allowedOnceClauses = [
VersionedClause<ACCC_If>
VersionedClause<ACCC_If>,
VersionedClause<ACCC_Default>
];
let requiredClauses = [
VersionedClause<ACCC_Attach>,