[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / barrier_messages.cpp
blob1dda66b9b242592344d0c4b551d0c5c15bbfebdd
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
5 template <class T>
6 T tmain(T argc) {
7 #pragma omp barrier
9 #pragma omp barrier allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp barrier'}}
10 #pragma omp barrier untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp barrier'}}
11 #pragma omp barrier unknown // expected-warning {{extra tokens at the end of '#pragma omp barrier' are ignored}}
12 if (argc)
13 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
14 if (argc) {
15 #pragma omp barrier
17 while (argc)
18 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
19 while (argc) {
20 #pragma omp barrier
23 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
24 while (argc)
26 do {
27 #pragma omp barrier
28 } while (argc);
29 switch (argc)
30 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
31 switch (argc)
32 case 1:
33 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
34 switch (argc)
35 case 1: {
36 #pragma omp barrier
38 switch (argc) {
39 #pragma omp barrier
40 case 1:
41 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
42 break;
43 default: {
44 #pragma omp barrier
45 } break;
47 for (;;)
48 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
49 for (;;) {
50 #pragma omp barrier
52 label:
53 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
54 label1 : {
55 #pragma omp barrier
58 return T();
61 int main(int argc, char **argv) {
62 #pragma omp barrier
64 #pragma omp barrier untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp barrier'}}
65 #pragma omp barrier unknown // expected-warning {{extra tokens at the end of '#pragma omp barrier' are ignored}}
66 if (argc)
67 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
68 if (argc) {
69 #pragma omp barrier
71 while (argc)
72 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
73 while (argc) {
74 #pragma omp barrier
77 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
78 while (argc)
80 do {
81 #pragma omp barrier
82 } while (argc);
83 switch (argc)
84 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
85 switch (argc)
86 case 1:
87 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
88 switch (argc)
89 case 1: {
90 #pragma omp barrier
92 switch (argc) {
93 #pragma omp barrier
94 case 1:
95 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
96 break;
97 default: {
98 #pragma omp barrier
99 } break;
101 for (;;)
102 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
103 for (;;) {
104 #pragma omp barrier
106 label:
107 #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
108 label1 : {
109 #pragma omp barrier
112 return tmain(argc);