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 9 void foo() {} 10 11 template <class T, int N> 12 T tmain(T argc) { 13 T b = argc, c, d, e, f, g; 14 static T a; 15 // CHECK: static T a; 16 #pragma omp for schedule(dynamic) 17 // CHECK-NEXT: #pragma omp for schedule(dynamic) 18 for (int i = 0; i < 2; ++i) 19 a = 2; 20 // CHECK-NEXT: for (int i = 0; i < 2; ++i) 21 // CHECK-NEXT: a = 2; 22 #pragma omp parallel 23 #pragma omp for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered nowait 24 for (int i = 0; i < 10; ++i) 25 for (int j = 0; j < 10; ++j) 26 for (int j = 0; j < 10; ++j) 27 for (int j = 0; j < 10; ++j) 28 for (int j = 0; j < 10; ++j) 29 foo(); 30 // CHECK-NEXT: #pragma omp parallel 31 // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered nowait 32 // CHECK-NEXT: for (int i = 0; i < 10; ++i) 33 // CHECK-NEXT: for (int j = 0; j < 10; ++j) 34 // CHECK-NEXT: for (int j = 0; j < 10; ++j) 35 // CHECK-NEXT: for (int j = 0; j < 10; ++j) 36 // CHECK-NEXT: for (int j = 0; j < 10; ++j) 37 // CHECK-NEXT: foo(); 38 return T(); 39 } 40 41 int main(int argc, char **argv) { 42 int b = argc, c, d, e, f, g; 43 static int a; 44 // CHECK: static int a; 45 #pragma omp for schedule(guided, argc) 46 // CHECK-NEXT: #pragma omp for schedule(guided, argc) 47 for (int i = 0; i < 2; ++i) 48 a = 2; 49 // CHECK-NEXT: for (int i = 0; i < 2; ++i) 50 // CHECK-NEXT: a = 2; 51 #pragma omp parallel 52 #pragma omp for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered nowait 53 for (int i = 0; i < 10; ++i) 54 for (int j = 0; j < 10; ++j) 55 foo(); 56 // CHECK-NEXT: #pragma omp parallel 57 // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) ordered nowait 58 // CHECK-NEXT: for (int i = 0; i < 10; ++i) 59 // CHECK-NEXT: for (int j = 0; j < 10; ++j) 60 // CHECK-NEXT: foo(); 61 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); 62 } 63 64 #endif 65