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
foo()9 void foo() {}
10
11 // CHECK: template <typename T, int N> int tmain(T argc, char **argv)
12 template <typename T, int N>
tmain(T argc,char ** argv)13 int tmain (T argc, char **argv) {
14 T b = argc, c, d, e, f, g;
15 static int a;
16 // CHECK: static int a;
17 #pragma omp critical
18 a=2;
19 // CHECK-NEXT: #pragma omp critical
20 // CHECK-NEXT: a = 2;
21 // CHECK-NEXT: ++a;
22 ++a;
23 #pragma omp critical (the_name) hint(N)
24 foo();
25 // CHECK-NEXT: #pragma omp critical (the_name) hint(N)
26 // CHECK-NEXT: foo();
27 // CHECK-NEXT: return N;
28 return N;
29 }
30
main(int argc,char ** argv)31 int main (int argc, char **argv) {
32 int b = argc, c, d, e, f, g;
33 static int a;
34 // CHECK: static int a;
35 #pragma omp critical
36 a=2;
37 // CHECK-NEXT: #pragma omp critical
38 // CHECK-NEXT: a = 2;
39 // CHECK-NEXT: ++a;
40 ++a;
41 #pragma omp critical (the_name1) hint(23)
42 foo();
43 // CHECK-NEXT: #pragma omp critical (the_name1) hint(23)
44 // CHECK-NEXT: foo();
45 // CHECK-NEXT: return tmain<int, 4>(a, argv);
46 return tmain<int, 4>(a, argv);
47 }
48
49 #endif
50