[TySan] Don't report globals with incomplete types. (#121922)
[llvm-project.git] / clang / test / OpenMP / teams_ast_print.cpp
blob597a9b2bdbdc5db68516823eade52a99de27dd60
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 -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
15 template <class T>
16 struct S {
17 operator T() {return T();}
18 static T TS;
19 #pragma omp threadprivate(TS)
22 // CHECK: template <class T> struct S {
23 // CHECK: static T TS;
24 // CHECK-NEXT: #pragma omp threadprivate(S::TS)
25 // CHECK: };
26 // CHECK: template<> struct S<int> {
27 // CHECK: static int TS;
28 // CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
29 // CHECK-NEXT: }
31 template <typename T, int C>
32 T tmain(T argc, T *argv) {
33 T b = argc, c, d, e, f, g;
34 static T a;
35 S<T> s;
36 #pragma omp teams
37 a=2;
38 #pragma omp target
39 #pragma omp teams
40 a=2;
41 #pragma omp target
42 #pragma omp teams default(none), private(argc,b) firstprivate(argv) shared (d) reduction(+:c) reduction(max:e) num_teams(C) thread_limit(d*C)
43 foo();
44 #pragma omp target
45 #pragma omp teams reduction(^:e, f) reduction(&& : g)
46 foo();
47 return 0;
50 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
51 // CHECK-NEXT: T b = argc, c, d, e, f, g;
52 // CHECK-NEXT: static T a;
53 // CHECK-NEXT: S<T> s;
54 // CHECK-NEXT: #pragma omp teams
55 // CHECK-NEXT: a = 2;
56 // CHECK-NEXT: #pragma omp target
57 // CHECK-NEXT: #pragma omp teams{{$}}
58 // CHECK-NEXT: a = 2;
59 // CHECK-NEXT: #pragma omp target
60 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C)
61 // CHECK-NEXT: foo()
62 // CHECK-NEXT: #pragma omp target
63 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
64 // CHECK-NEXT: foo()
65 // CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
66 // CHECK-NEXT: int b = argc, c, d, e, f, g;
67 // CHECK-NEXT: static int a;
68 // CHECK-NEXT: S<int> s;
69 // CHECK-NEXT: #pragma omp teams
70 // CHECK-NEXT: a = 2;
71 // CHECK-NEXT: #pragma omp target
72 // CHECK-NEXT: #pragma omp teams
73 // CHECK-NEXT: a = 2;
74 // CHECK-NEXT: #pragma omp target
75 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5)
76 // CHECK-NEXT: foo()
77 // CHECK-NEXT: #pragma omp target
78 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
79 // CHECK-NEXT: foo()
80 // CHECK: template<> long tmain<long, 1>(long argc, long *argv) {
81 // CHECK-NEXT: long b = argc, c, d, e, f, g;
82 // CHECK-NEXT: static long a;
83 // CHECK-NEXT: S<long> s;
84 // CHECK-NEXT: #pragma omp teams
85 // CHECK-NEXT: a = 2;
86 // CHECK-NEXT: #pragma omp target
87 // CHECK-NEXT: #pragma omp teams
88 // CHECK-NEXT: a = 2;
89 // CHECK-NEXT: #pragma omp target
90 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1)
91 // CHECK-NEXT: foo()
92 // CHECK-NEXT: #pragma omp target
93 // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
94 // CHECK-NEXT: foo()
96 enum Enum { };
98 int main (int argc, char **argv) {
99 long x;
100 int b = argc, c, d, e, f, g;
101 static int a;
102 #pragma omp threadprivate(a)
103 Enum ee;
104 // CHECK: Enum ee;
105 #pragma omp target
106 #pragma omp teams
107 // CHECK-NEXT: #pragma omp target
108 // CHECK-NEXT: #pragma omp teams
109 a=2;
110 // CHECK-NEXT: a = 2;
111 #pragma omp target
112 #pragma omp teams default(none), private(argc,b) num_teams(f) firstprivate(argv) reduction(| : c, d) reduction(* : e) thread_limit(f+g)
113 // CHECK-NEXT: #pragma omp target
114 // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) num_teams(f) firstprivate(argv) reduction(|: c,d) reduction(*: e) thread_limit(f + g)
115 foo();
116 // CHECK-NEXT: foo();
117 return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x);
120 extern template int S<int>::TS;
121 extern template long S<long>::TS;
122 #endif