1*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
2*73e5d7bdSFazlay Rabbi 
3*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
4*73e5d7bdSFazlay Rabbi 
foo()5*73e5d7bdSFazlay Rabbi void foo() {
6*73e5d7bdSFazlay Rabbi }
7*73e5d7bdSFazlay Rabbi 
foobool(int argc)8*73e5d7bdSFazlay Rabbi bool foobool(int argc) {
9*73e5d7bdSFazlay Rabbi   return argc;
10*73e5d7bdSFazlay Rabbi }
11*73e5d7bdSFazlay Rabbi 
12*73e5d7bdSFazlay Rabbi struct S1; // expected-note {{declared here}}
13*73e5d7bdSFazlay Rabbi 
14*73e5d7bdSFazlay Rabbi template <class T, class S> // expected-note {{declared here}}
tmain(T argc,S ** argv)15*73e5d7bdSFazlay Rabbi int tmain(T argc, S **argv) {
16*73e5d7bdSFazlay Rabbi   T z;
17*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority // expected-error {{expected '(' after 'priority'}}
18*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
19*73e5d7bdSFazlay Rabbi     foo();
20*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
21*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
22*73e5d7bdSFazlay Rabbi     foo();
23*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority () // expected-error {{expected expression}}
24*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
25*73e5d7bdSFazlay Rabbi     foo();
26*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
27*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
28*73e5d7bdSFazlay Rabbi     foo();
29*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc + z)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
30*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
31*73e5d7bdSFazlay Rabbi     foo();
32*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc > 0 ? argv[1][0] : argv[2][argc])
33*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
34*73e5d7bdSFazlay Rabbi     foo();
35*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (foobool(argc)), priority (true) // expected-error {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'priority' clause}}
36*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
37*73e5d7bdSFazlay Rabbi     foo();
38*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (S) // expected-error {{'S' does not refer to a value}}
39*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
40*73e5d7bdSFazlay Rabbi     foo();
41*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
42*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
43*73e5d7bdSFazlay Rabbi     foo();
44*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority(0)
45*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
46*73e5d7bdSFazlay Rabbi     foo();
47*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority(-1) // expected-error {{argument to 'priority' clause must be a non-negative integer value}}
48*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
49*73e5d7bdSFazlay Rabbi     foo();
50*73e5d7bdSFazlay Rabbi 
51*73e5d7bdSFazlay Rabbi   return 0;
52*73e5d7bdSFazlay Rabbi }
53*73e5d7bdSFazlay Rabbi 
main(int argc,char ** argv)54*73e5d7bdSFazlay Rabbi int main(int argc, char **argv) {
55*73e5d7bdSFazlay Rabbi   int tid = 0;
56*73e5d7bdSFazlay Rabbi   int z;
57*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority filter(tid) // expected-error {{expected '(' after 'priority'}}
58*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
59*73e5d7bdSFazlay Rabbi     foo();
60*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
61*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
62*73e5d7bdSFazlay Rabbi     foo();
63*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority () // expected-error {{expected expression}}
64*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
65*73e5d7bdSFazlay Rabbi     foo();
66*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
67*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
68*73e5d7bdSFazlay Rabbi     foo();
69*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc + z)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
70*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
71*73e5d7bdSFazlay Rabbi     foo();
72*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc > 0 ? argv[1][0] : argv[2][argc])
73*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
74*73e5d7bdSFazlay Rabbi     foo();
75*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (foobool(argc)), priority (true) // expected-error {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'priority' clause}}
76*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
77*73e5d7bdSFazlay Rabbi     foo();
78*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (S1) // expected-error {{'S1' does not refer to a value}}
79*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
80*73e5d7bdSFazlay Rabbi     foo();
81*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
82*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
83*73e5d7bdSFazlay Rabbi     foo();
84*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
85*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
86*73e5d7bdSFazlay Rabbi     foo();
87*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
88*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
89*73e5d7bdSFazlay Rabbi     foo();
90*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority(0)
91*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
92*73e5d7bdSFazlay Rabbi     foo();
93*73e5d7bdSFazlay Rabbi   #pragma omp masked taskloop simd priority(-1) // expected-error {{argument to 'priority' clause must be a non-negative integer value}}
94*73e5d7bdSFazlay Rabbi   for (int i = 0; i < 10; ++i)
95*73e5d7bdSFazlay Rabbi     foo();
96*73e5d7bdSFazlay Rabbi 
97*73e5d7bdSFazlay Rabbi   return tmain(argc, argv);
98*73e5d7bdSFazlay Rabbi }
99