[Offload] Fix offload-info interface
[llvm-project.git] / clang / test / ParserOpenACC / parse-cache-construct.c
blob8937aa095d5eaac5d1342e13b050d0755d9c2ade
1 // RUN: %clang_cc1 %s -verify -fopenacc
3 struct S {
4 int foo;
5 char Array[1];
6 };
7 char *getArrayPtr();
8 void func() {
9 char Array[10];
10 char *ArrayPtr = getArrayPtr();
11 int *readonly;
12 struct S s;
14 for (int i = 0; i < 10; ++i) {
15 // expected-error@+2{{expected '('}}
16 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
17 #pragma acc cache
20 for (int i = 0; i < 10; ++i) {
21 // expected-error@+3{{expected '('}}
22 // expected-error@+2{{invalid OpenACC clause 'clause'}}
23 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
24 #pragma acc cache clause list
27 for (int i = 0; i < 10; ++i) {
28 // expected-error@+2{{expected expression}}
29 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
30 #pragma acc cache()
33 for (int i = 0; i < 10; ++i) {
34 // expected-error@+3{{expected expression}}
35 // expected-error@+2{{invalid OpenACC clause 'clause'}}
36 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
37 #pragma acc cache() clause-list
40 for (int i = 0; i < 10; ++i) {
41 // expected-error@+3{{expected ')'}}
42 // expected-note@+2{{to match this '('}}
43 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
44 #pragma acc cache(
47 for (int i = 0; i < 10; ++i) {
48 // expected-error@+4{{use of undeclared identifier 'invalid'}}
49 // expected-error@+3{{expected ')'}}
50 // expected-note@+2{{to match this '('}}
51 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
52 #pragma acc cache(invalid
55 for (int i = 0; i < 10; ++i) {
56 // expected-error@+3{{expected ')'}}
57 // expected-note@+2{{to match this '('}}
58 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
59 #pragma acc cache(ArrayPtr
62 for (int i = 0; i < 10; ++i) {
63 // expected-error@+2{{use of undeclared identifier 'invalid'}}
64 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
65 #pragma acc cache(invalid)
68 for (int i = 0; i < 10; ++i) {
69 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
70 #pragma acc cache(ArrayPtr)
73 for (int i = 0; i < 10; ++i) {
74 // expected-error@+6{{expected expression}}
75 // expected-error@+5{{expected ']'}}
76 // expected-note@+4{{to match this '['}}
77 // expected-error@+3{{expected ')'}}
78 // expected-note@+2{{to match this '('}}
79 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
80 #pragma acc cache(ArrayPtr[
83 for (int i = 0; i < 10; ++i) {
84 // expected-error@+4{{expected expression}}
85 // expected-error@+3{{expected ']'}}
86 // expected-note@+2{{to match this '['}}
87 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
88 #pragma acc cache(ArrayPtr[, 5)
91 for (int i = 0; i < 10; ++i) {
92 // expected-error@+4{{expected expression}}
93 // expected-error@+3{{expected ']'}}
94 // expected-note@+2{{to match this '['}}
95 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
96 #pragma acc cache(Array[)
99 for (int i = 0; i < 10; ++i) {
100 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
101 #pragma acc cache(Array[*readonly])
104 for (int i = 0; i < 10; ++i) {
105 // expected-error@+6{{expected expression}}
106 // expected-error@+5{{expected ']'}}
107 // expected-note@+4{{to match this '['}}
108 // expected-error@+3{{expected ')'}}
109 // expected-note@+2{{to match this '('}}
110 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
111 #pragma acc cache(Array[*readonly:
114 for (int i = 0; i < 10; ++i) {
115 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
116 #pragma acc cache(readonly)
119 for (int i = 0; i < 10; ++i) {
120 // expected-error@+2{{invalid tag 'devnum' on 'cache' directive}}
121 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
122 #pragma acc cache(devnum:ArrayPtr)
125 for (int i = 0; i < 10; ++i) {
126 // expected-error@+2{{invalid tag 'invalid' on 'cache' directive}}
127 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
128 #pragma acc cache(invalid:ArrayPtr)
131 for (int i = 0; i < 10; ++i) {
132 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
133 #pragma acc cache(readonly:ArrayPtr)
136 for (int i = 0; i < 10; ++i) {
137 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
138 #pragma acc cache(readonly:ArrayPtr[5:1])
141 for (int i = 0; i < 10; ++i) {
142 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
143 #pragma acc cache(readonly:ArrayPtr[5:*readonly])
146 for (int i = 0; i < 10; ++i) {
147 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
148 #pragma acc cache(readonly:ArrayPtr[5:*readonly], Array)
151 for (int i = 0; i < 10; ++i) {
152 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
153 #pragma acc cache(readonly:ArrayPtr[5:*readonly], Array[*readonly:3])
156 for (int i = 0; i < 10; ++i) {
157 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
158 #pragma acc cache(readonly:ArrayPtr[5 + i:*readonly], Array[*readonly + i:3])
161 for (int i = 0; i < 10; ++i) {
162 // expected-error@+4{{expected expression}}
163 // expected-error@+3{{expected ')'}}
164 // expected-note@+2{{to match this '('}}
165 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
166 #pragma acc cache(readonly:ArrayPtr[5:*readonly],
169 for (int i = 0; i < 10; ++i) {
170 // expected-error@+2{{expected expression}}
171 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
172 #pragma acc cache(readonly:ArrayPtr[5:*readonly],)
175 for (int i = 0; i < 10; ++i) {
176 // expected-warning@+2{{left operand of comma operator has no effect}}
177 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
178 #pragma acc cache(readonly:ArrayPtr[5,6:*readonly])
181 for (int i = 0; i < 10; ++i) {
182 // expected-warning@+2{{left operand of comma operator has no effect}}
183 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
184 #pragma acc cache(readonly:ArrayPtr[5:3, *readonly], ArrayPtr[0])
187 for (int i = 0; i < 10; ++i) {
188 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
189 #pragma acc cache(readonly:s.foo)
192 for (int i = 0; i < 10; ++i) {
193 // expected-warning@+2{{left operand of comma operator has no effect}}
194 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
195 #pragma acc cache(readonly:s.Array[1,2])