xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/single_ast_print.cpp (revision bdb565187c0f1a04513dd488df843317b27f86c8)
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 parallel private(g)
17 #pragma omp single private(argc, b), firstprivate(c, d), nowait copyprivate(g)
18   foo();
19   // CHECK-NEXT: #pragma omp parallel private(g)
20   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait copyprivate(g)
21   // CHECK-NEXT: foo();
22   return T();
23 }
24 
25 int main(int argc, char **argv) {
26   int b = argc, c, d, e, f, g;
27   static int a;
28 // CHECK: static int a;
29 #pragma omp parallel private(g)
30 #pragma omp single private(argc, b), firstprivate(argv, c), nowait copyprivate(g)
31   foo();
32   // CHECK-NEXT: #pragma omp parallel private(g)
33   // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(argv,c) nowait copyprivate(g)
34   // CHECK-NEXT: foo();
35   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
36 }
37 
38 #endif
39