1 // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp=libiomp5 -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 template <class T>
tmain(T argc)12 T tmain (T argc) {
13   T b = argc, c, d, e, f, g;
14   static T a;
15   #pragma omp for ordered
16   for (int i =0 ; i < argc; ++i)
17   #pragma omp ordered
18   {
19     a=2;
20   }
21   return (0);
22 }
23 
24 // CHECK: static int a;
25 // CHECK-NEXT: #pragma omp for ordered
26 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
27 // CHECK-NEXT: #pragma omp ordered
28 // CHECK-NEXT: {
29 // CHECK-NEXT: a = 2;
30 // CHECK-NEXT: }
31 
32 // CHECK: static T a;
33 // CHECK-NEXT: #pragma omp for ordered
34 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
35 // CHECK-NEXT: #pragma omp ordered
36 // CHECK-NEXT: {
37 // CHECK-NEXT: a = 2;
38 // CHECK-NEXT: }
39 
main(int argc,char ** argv)40 int main (int argc, char **argv) {
41   int b = argc, c, d, e, f, g;
42   static int a;
43 // CHECK: static int a;
44   #pragma omp for ordered
45   for (int i =0 ; i < argc; ++i)
46   #pragma omp ordered
47   {
48     a=2;
49   }
50 // CHECK-NEXT: #pragma omp for ordered
51 // CHECK-NEXT: for (int i = 0; i < argc; ++i)
52 // CHECK-NEXT: #pragma omp ordered
53 // CHECK-NEXT: {
54 // CHECK-NEXT: a = 2;
55 // CHECK-NEXT: }
56   return tmain(argc);
57 }
58 
59 #endif
60