[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / data-construct-present-clause.c
blobb889230d177cdc9afec4e0c41be45618a2dc14b9
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 typedef struct IsComplete {
4 struct S { int A; } CompositeMember;
5 int ScalarMember;
6 float ArrayMember[5];
7 void *PointerMember;
8 } Complete;
9 void uses(int IntParam, short *PointerParam, float ArrayParam[5], Complete CompositeParam) {
10 int LocalInt;
11 short *LocalPointer;
12 float LocalArray[5];
13 Complete LocalComposite;
14 // Check Appertainment:
15 #pragma acc data default(none) present(LocalInt)
18 // Valid cases:
19 #pragma acc data default(none) present(LocalInt, LocalPointer, LocalArray)
21 #pragma acc data default(none) present(LocalArray[2:1])
24 #pragma acc data default(none) present(LocalComposite.ScalarMember, LocalComposite.ScalarMember)
27 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
28 #pragma acc data default(none) present(1 + IntParam)
31 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
32 #pragma acc data default(none) present(+IntParam)
35 // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}
36 #pragma acc data default(none) present(PointerParam[2:])
39 // expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
40 #pragma acc data default(none) present(ArrayParam[2:5])
43 // expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
44 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
45 #pragma acc data default(none) present((float*)ArrayParam[2:5])
47 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
48 #pragma acc data default(none) present((float)ArrayParam[2])
51 // expected-error@+1{{OpenACC 'present' clause is not valid on 'enter data' directive}}
52 #pragma acc enter data copyin(LocalInt) present(LocalInt)
53 // expected-error@+1{{OpenACC 'present' clause is not valid on 'exit data' directive}}
54 #pragma acc exit data copyout(LocalInt) present(LocalInt)
55 // expected-error@+1{{OpenACC 'present' clause is not valid on 'host_data' directive}}
56 #pragma acc host_data use_device(LocalInt) present(LocalInt)