1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
4 // expected-no-diagnostics
5 
6 #ifndef HEADER
7 #define HEADER
8 
9 void foo() {}
10 
11 template <class T>
12 T tmain(T argc) {
13   static T a;
14 #pragma omp barrier
15   switch (argc) {
16   case 0:
17 #pragma omp barrier
18     break;
19   default:
20 #pragma omp barrier
21 #pragma omp barrier
22     break;
23   }
24   return a + argc;
25 }
26 // CHECK:      static int a;
27 // CHECK-NEXT: #pragma omp barrier
28 // CHECK:      static char a;
29 // CHECK-NEXT: #pragma omp barrier
30 // CHECK:      static T a;
31 // CHECK-NEXT: #pragma omp barrier
32 // CHECK-NEXT: switch (argc) {
33 // CHECK-NEXT: case 0:
34 // CHECK-NEXT: #pragma omp barrier
35 // CHECK-NEXT: break;
36 // CHECK-NEXT: default:
37 // CHECK-NEXT: #pragma omp barrier
38 // CHECK-NEXT: #pragma omp barrier
39 // CHECK-NEXT: break;
40 // CHECK-NEXT: }
41 
42 int main(int argc, char **argv) {
43   static int a;
44 // CHECK: static int a;
45 #pragma omp barrier
46   // CHECK-NEXT: #pragma omp barrier
47   switch (argc) {
48   case 0:
49 #pragma omp barrier
50 #pragma omp barrier
51     break;
52   default:
53 #pragma omp barrier
54     break;
55   }
56 // CHECK-NEXT: switch (argc) {
57 // CHECK-NEXT: case 0:
58 // CHECK-NEXT: #pragma omp barrier
59 // CHECK-NEXT: #pragma omp barrier
60 // CHECK-NEXT: break;
61 // CHECK-NEXT: default:
62 // CHECK-NEXT: #pragma omp barrier
63 // CHECK-NEXT: break;
64 // CHECK-NEXT: }
65   return tmain(argc) + tmain(argv[0][0]) + a;
66 }
67 
68 #endif
69