[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / combined-construct-attach-clause.c
blob49a64a48196ba0a8ff914beea68169edfeee0d5d
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 struct S {
4 int IntMem;
5 int *PtrMem;
6 };
8 void uses() {
9 int LocalInt;
10 int *LocalPtr;
11 int Array[5];
12 int *PtrArray[5];
13 struct S s;
15 // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}
16 #pragma acc parallel loop attach(LocalInt)
17 for (unsigned i = 0; i < 5; ++i);
19 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
20 #pragma acc parallel loop attach(&LocalInt)
21 for (unsigned i = 0; i < 5; ++i);
23 #pragma acc serial loop attach(LocalPtr)
24 for (unsigned i = 0; i < 5; ++i);
26 // expected-error@+1{{expected pointer in 'attach' clause, type is 'int[5]'}}
27 #pragma acc kernels loop attach(Array)
28 for (unsigned i = 0; i < 5; ++i);
30 // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}
31 #pragma acc parallel loop attach(Array[0])
32 for (unsigned i = 0; i < 5; ++i);
34 // expected-error@+2{{OpenACC sub-array is not allowed here}}
35 // expected-note@+1{{expected variable of pointer type}}
36 #pragma acc parallel loop attach(Array[0:1])
37 for (unsigned i = 0; i < 5; ++i);
39 // expected-error@+1{{expected pointer in 'attach' clause, type is 'int *[5]'}}
40 #pragma acc parallel loop attach(PtrArray)
41 for (unsigned i = 0; i < 5; ++i);
43 #pragma acc parallel loop attach(PtrArray[0])
44 for (unsigned i = 0; i < 5; ++i);
46 // expected-error@+2{{OpenACC sub-array is not allowed here}}
47 // expected-note@+1{{expected variable of pointer type}}
48 #pragma acc parallel loop attach(PtrArray[0:1])
49 for (unsigned i = 0; i < 5; ++i);
51 // expected-error@+1{{expected pointer in 'attach' clause, type is 'struct S'}}
52 #pragma acc parallel loop attach(s)
53 for (unsigned i = 0; i < 5; ++i);
55 // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}}
56 #pragma acc parallel loop attach(s.IntMem)
57 for (unsigned i = 0; i < 5; ++i);
59 #pragma acc parallel loop attach(s.PtrMem)
60 for (unsigned i = 0; i < 5; ++i);
62 // expected-error@+1{{OpenACC 'attach' clause is not valid on 'loop' directive}}
63 #pragma acc loop attach(LocalInt)
64 for(int i = 5; i < 10;++i);