// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
// expected-no-diagnostics
typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_null_allocator;
extern const omp_allocator_handle_t omp_default_mem_alloc;
extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
extern const omp_allocator_handle_t omp_const_mem_alloc;
extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;
void
;
// CHECK: template <class T> struct S {
// CHECK: static T TS;
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
// CHECK: };
// CHECK: template<> struct S<int> {
// CHECK: static int TS;
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
// CHECK-NEXT: }
// CHECK: template<> struct S<char> {
// CHECK: static char TS;
// CHECK-NEXT: #pragma omp threadprivate(S<char>::TS)
// CHECK-NEXT: }
T
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
// CHECK-NEXT: T b = argc, c, d, e, f, g;
// CHECK-NEXT: static T h;
// CHECK-NEXT: S<T> s;
// CHECK-NEXT: T arr[C][10], arr1[C];
// CHECK-NEXT: T i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel{{$}}
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel allocate(omp_large_cap_mem_alloc: argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) uses_allocators(omp_large_cap_mem_alloc)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(C)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: a[0:10],i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(to: i) map(from: j)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(always,alloc: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel nowait
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel depend(in : argc,argv[i:argc],a[:])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
// CHECK-NEXT: foo()
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
// CHECK-NEXT: int b = argc, c, d, e, f, g;
// CHECK-NEXT: static int h;
// CHECK-NEXT: S<int> s;
// CHECK-NEXT: int arr[5][10], arr1[5];
// CHECK-NEXT: int i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel allocate(omp_large_cap_mem_alloc: argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10]) uses_allocators(omp_large_cap_mem_alloc)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(5)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: a[0:10],i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(to: i) map(from: j)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(always,alloc: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel nowait
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel depend(in : argc,argv[i:argc],a[:])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
// CHECK-NEXT: foo()
// CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
// CHECK-NEXT: char b = argc, c, d, e, f, g;
// CHECK-NEXT: static char h;
// CHECK-NEXT: S<char> s;
// CHECK-NEXT: char arr[1][10], arr1[1];
// CHECK-NEXT: char i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel allocate(omp_large_cap_mem_alloc: argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10]) uses_allocators(omp_large_cap_mem_alloc)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(1)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(tofrom: a[0:10],i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(to: i) map(from: j)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel map(always,alloc: i)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel nowait
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel depend(in : argc,argv[i:argc],a[:])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
// CHECK-NEXT: foo()
// CHECK-LABEL: int main(int argc, char **argv) {
int
extern ;
extern ;