[flang][OpenMP] 'no_openmp_constructs' added to clang broke flang build (#126145)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-self-clause.c
blob1d1cbaabbdc3c219b2e87f3cd768fd4858cd2c78
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 void BoolExpr(int *I, float *F) {
4 typedef struct {} SomeStruct;
5 struct C{};
6 // expected-error@+1{{expected expression}}
7 #pragma acc parallel self (struct C f())
8 while(0);
10 // expected-error@+1{{unexpected type name 'SomeStruct': expected expression}}
11 #pragma acc serial self (SomeStruct)
12 while(0);
14 // expected-error@+1{{unexpected type name 'SomeStruct': expected expression}}
15 #pragma acc serial self (SomeStruct())
16 while(0);
18 SomeStruct S;
19 // expected-error@+1{{statement requires expression of scalar type ('SomeStruct' invalid)}}
20 #pragma acc serial self (S)
21 while(0);
23 #pragma acc parallel self (I)
24 while(0);
26 #pragma acc serial self (F)
27 while(0);
29 #pragma acc kernels self (*I < *F)
30 while(0);
33 void WarnMaybeNotUsed(int val1, int val2) {
35 // expected-warning@+2{{OpenACC construct 'self' has no effect when an 'if' clause evaluates to true}}
36 // expected-note@+1{{previous clause is here}}
37 #pragma acc parallel self if(val1)
38 while(0);
40 // expected-warning@+2{{OpenACC construct 'self' has no effect when an 'if' clause evaluates to true}}
41 // expected-note@+1{{previous clause is here}}
42 #pragma acc parallel self(val1) if(val1)
43 while(0);
45 // expected-warning@+2{{OpenACC construct 'self' has no effect when an 'if' clause evaluates to true}}
46 // expected-note@+1{{previous clause is here}}
47 #pragma acc parallel if(val1) self
48 while(0);
50 // expected-warning@+2{{OpenACC construct 'self' has no effect when an 'if' clause evaluates to true}}
51 // expected-note@+1{{previous clause is here}}
52 #pragma acc parallel if(val1) self(val2)
53 while(0);
55 // The below don't warn because one side or the other has an error, thus is
56 // not added to the AST.
58 // expected-error@+1{{use of undeclared identifier 'invalid'}}
59 #pragma acc parallel self if(invalid)
60 while(0);
62 // expected-error@+1{{use of undeclared identifier 'invalid'}}
63 #pragma acc parallel self(invalid) if(val1)
64 while(0);
66 // expected-error@+2{{expected expression}}
67 // expected-error@+1{{use of undeclared identifier 'invalid'}}
68 #pragma acc parallel self() if(invalid)
69 while(0);
71 // expected-error@+1{{use of undeclared identifier 'invalid'}}
72 #pragma acc parallel if(invalid) self
73 while(0);
75 // expected-error@+1{{use of undeclared identifier 'invalid'}}
76 #pragma acc parallel if(val2) self(invalid)
77 while(0);
79 // expected-error@+1{{use of undeclared identifier 'invalid'}}
80 #pragma acc parallel if(invalid) self(val1)
81 while(0);
83 // expected-error@+1{{OpenACC 'self' clause is not valid on 'loop' directive}}
84 #pragma acc loop self
85 for(int i = 5; i < 10;++i);