Home | History | Annotate | Download | only in OpenMP
      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, 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 parallel private(g)
     17 #pragma omp single private(argc, b), firstprivate(c, d), nowait
     18   foo();
     19   // CHECK-NEXT: #pragma omp parallel private(g)
     20   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait
     21   // CHECK-NEXT: foo();
     22 #pragma omp parallel private(g)
     23 #pragma omp single private(argc, b), firstprivate(c, d), copyprivate(g)
     24   foo();
     25   // CHECK-NEXT: #pragma omp parallel private(g)
     26   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) copyprivate(g)
     27   // CHECK-NEXT: foo();
     28   return T();
     29 }
     30 
     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 parallel private(g)
     36 #pragma omp single private(argc, b), firstprivate(argv, c), nowait
     37   foo();
     38   // CHECK-NEXT: #pragma omp parallel private(g)
     39   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(argv,c) nowait
     40   // CHECK-NEXT: foo();
     41 #pragma omp parallel private(g)
     42 #pragma omp single private(argc, b), firstprivate(c, d), copyprivate(g)
     43   foo();
     44   // CHECK-NEXT: #pragma omp parallel private(g)
     45   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) copyprivate(g)
     46   // CHECK-NEXT: foo();
     47   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
     48 }
     49 
     50 #endif
     51