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