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